Skip to content

Commit

Permalink
fix: redirects in some cross-domain scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKolarik committed Oct 13, 2024
1 parent bfe9c47 commit 9e4ce21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/oauth/route/authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type StateObject = { state?: string } | undefined;
const handle = (options: OAuthRouteOptions) => {
return async (ctx: ExtendedContext): Promise<void> => {
if (!ctx.state.user || ctx.state.user.authMode !== 'cookie') {
return ctx.redirect(`${options.directusHost}/auth/login/github?redirect=${options.serverHost}${encodeURIComponent(ctx.url)}`);
return ctx.redirect(`${options.directusHost}/auth/login/github?redirect=${encodeURIComponent(`/redirect?url=${encodeURIComponent(`${options.serverHost}${ctx.url}`)}`)}`);
}

const user = ctx.state.user;
Expand Down

0 comments on commit 9e4ce21

Please sign in to comment.