feat(SW-158): Implemented seamless login in magic link login
This commit is contained in:
@@ -16,6 +16,7 @@ export async function GET(
|
||||
|
||||
const returnUrl = request.headers.get("x-returnurl")
|
||||
const isMFA = request.headers.get("x-mfa-login")
|
||||
const isMagicLinkLogin = !!request.headers.get("x-magic-link")
|
||||
|
||||
if (returnUrl) {
|
||||
// Seamless login request from Current web
|
||||
@@ -86,33 +87,37 @@ export async function GET(
|
||||
console.log({ login_env: process.env })
|
||||
|
||||
console.log({ login_redirectTo: redirectTo })
|
||||
const params = isMFA
|
||||
? {
|
||||
ui_locales: context.params.lang,
|
||||
scope: ["profile_update", "openid", "profile"].join(" "),
|
||||
/**
|
||||
* The below acr value is required as for New Web same Curity Client is used for MFA
|
||||
* while in current web it is being setup using different Curity Client
|
||||
*/
|
||||
acr_values:
|
||||
"urn:se:curity:authentication:otp-authenticator:OTP-Authenticator_web",
|
||||
for_origin: env.PUBLIC_URL ? env.PUBLIC_URL : "",
|
||||
}
|
||||
: {
|
||||
ui_locales: context.params.lang,
|
||||
scope: ["openid", "profile"].join(" "),
|
||||
/**
|
||||
* The `acr_values` param is used to make Curity display the proper login
|
||||
* page for Scandic. Without the parameter Curity presents some choices
|
||||
* to the user which we do not want.
|
||||
*/
|
||||
acr_values: "acr",
|
||||
/**
|
||||
* The `for_origin` param is used to make Curity email login functionality working.
|
||||
* Without the parameter Curity gives Internal Error issue for login with Email link.
|
||||
*/
|
||||
for_origin: env.PUBLIC_URL ? env.PUBLIC_URL : "",
|
||||
}
|
||||
const params = {
|
||||
ui_locales: context.params.lang,
|
||||
scope: ["openid", "profile"].join(" "),
|
||||
/**
|
||||
* The `acr_values` param is used to make Curity display the proper login
|
||||
* page for Scandic. Without the parameter Curity presents some choices
|
||||
* to the user which we do not want.
|
||||
*/
|
||||
acr_values: "acr",
|
||||
/**
|
||||
* The `for_origin` param is used to make Curity email login functionality working.
|
||||
* Without the parameter Curity gives Internal Error issue for login with Email link.
|
||||
*/
|
||||
for_origin: env.PUBLIC_URL ? env.PUBLIC_URL : "",
|
||||
/**
|
||||
* This is new param set for differentiate between
|
||||
* the Magic link login of New web and current web
|
||||
*/
|
||||
version: "2",
|
||||
}
|
||||
if (isMFA) {
|
||||
params.scope = ["profile_update", "openid", "profile"].join(" ")
|
||||
/**
|
||||
* The below acr value is required as for New Web same Curity Client is used for MFA
|
||||
* while in current web it is being setup using different Curity Client
|
||||
*/
|
||||
params.acr_values =
|
||||
"urn:se:curity:authentication:otp-authenticator:OTP-Authenticator_web"
|
||||
} else if (isMagicLinkLogin) {
|
||||
params.acr_values = "abc"
|
||||
}
|
||||
const redirectUrl = await signIn(
|
||||
"curity",
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user