Skip to content

Add redirect override for auth login#239

Merged
krowvin merged 7 commits into
mainfrom
236-properties-for-authlogin
Jul 9, 2026
Merged

Add redirect override for auth login#239
krowvin merged 7 commits into
mainfrom
236-properties-for-authlogin

Conversation

@krowvin

@krowvin krowvin commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

@krowvin krowvin requested review from MikeNeilson and jbkolze April 22, 2026 21:45
@krowvin krowvin linked an issue Apr 22, 2026 that may be closed by this pull request
@tsressin

tsressin commented Apr 27, 2026

Copy link
Copy Markdown

I found this redirect code does not respect the query string and does not return to the page properly when a query string is needed.

              <Button
                title="You must login to access this page."
                color="white"
                onClick={() => {
                  auth.login({ redirectUri: window.location.href });
                }}
              >
                Login
              </Button>

For example, this page returns to this.
image
image

@krowvin krowvin marked this pull request as draft May 22, 2026 13:14
@krowvin krowvin requested review from oskarhurst and removed request for jbkolze May 22, 2026 14:01
@krowvin krowvin marked this pull request as ready for review May 22, 2026 14:01
@krowvin krowvin requested a review from msweier July 7, 2026 16:09
@msweier

msweier commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

A bit out of my wheelhouse, so claude is helping me. Overall looks good, using session storage is a good way to to store the return URL. The auth docs need to be updated though (this came after this PR was started). The redirectUri: window.location.href should be updated to redirectUri: window.location.origin to show users how to redirect to the current page.

The redirectUri could mean the stable registered callback in the config or the page return in the login() call. So maybe a JSDoc line on AuthLoginOptions.redirectUri in AuthContext.tsx like:

export interface AuthLoginOptions {
  /**
   * In-app URL to return the user to after sign-in. Stored locally and
   * restored after the callback. It is NOT sent to the identity provider.
   * The registered OIDC callback stays whatever you set as `redirectUri`
   * on createKeycloakAuthMethod().
   */
  redirectUri?: string;
}

@msweier msweier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@krowvin krowvin merged commit adbc9fb into main Jul 9, 2026
5 checks passed
@krowvin krowvin deleted the 236-properties-for-authlogin branch July 9, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Properties for auth.login

3 participants