mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-11 04:19:31 +00:00
fix(sso): saml redirection (#3343)
* saml redirection * loh * lint * dashboard * lint * test * test * function based mock idp * redirection and callbacks * console --------- Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
322906802f
commit
d66c6c935d
@@ -855,7 +855,9 @@ export const sso = (options?: SSOOptions) => {
|
||||
});
|
||||
}
|
||||
return ctx.json({
|
||||
url: loginRequest.context,
|
||||
url: `${loginRequest.context}&RelayState=${encodeURIComponent(
|
||||
body.callbackURL,
|
||||
)}`,
|
||||
redirect: true,
|
||||
});
|
||||
}
|
||||
@@ -1353,9 +1355,10 @@ export const sso = (options?: SSOOptions) => {
|
||||
let session: Session =
|
||||
await ctx.context.internalAdapter.createSession(user.id, ctx);
|
||||
await setSessionCookie(ctx, { session, user });
|
||||
console.log("RelayState: ", RelayState);
|
||||
throw ctx.redirect(
|
||||
RelayState || `${parsedSamlConfig.issuer}/dashboard`,
|
||||
RelayState ||
|
||||
`${parsedSamlConfig.callbackUrl}` ||
|
||||
`${parsedSamlConfig.issuer}`,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user