Skip to content

Commit

Permalink
fix: getAuthorizationUrl calls don't always include custom redirectUr…
Browse files Browse the repository at this point in the history
…i set in middleware (#209)
  • Loading branch information
nicknisi authored Feb 27, 2025
1 parent 6baafd3 commit b436606
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ async function updateSession(
// `pathname` to be able to return the users where they came from before sign-in
newRequestHeaders.set('x-url', request.url);

if (options.redirectUri) {
// Store the redirect URI in a custom header, so we always have access to it and so that subsequent
// calls to `getAuthorizationUrl` will use the same redirect URI
newRequestHeaders.set('x-redirect-uri', options.redirectUri);
}

newRequestHeaders.delete(sessionHeaderName);

if (!session) {
Expand Down

0 comments on commit b436606

Please sign in to comment.