feat: SW-158 Magic Link login support

This commit is contained in:
Hrishikesh Vaipurkar
2024-07-10 11:34:09 +02:00
parent 2ce21626b9
commit e14e3aaffa
2 changed files with 28 additions and 15 deletions

View File

@@ -96,6 +96,7 @@ export async function GET(
*/
acr_values:
"urn:se:curity:authentication:otp-authenticator:OTP-Authenticator_web",
for_origin: env.PUBLIC_URL ? env.PUBLIC_URL : "",
}
: {
ui_locales: context.params.lang,
@@ -110,7 +111,7 @@ export async function GET(
* 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,
for_origin: env.PUBLIC_URL ? env.PUBLIC_URL : "",
}
const redirectUrl = await signIn(
"curity",
@@ -122,6 +123,11 @@ export async function GET(
)
if (redirectUrl) {
// Remove nonce for User to be able to login via Magic Link, but normal login fails as nonce becomes absent in the token response
// if (redirectUrl.indexOf("nonce") != -1) {
// redirectUrl = redirectUrl.replace(/nonce=.*&code_challenge=/gi, "&code_challenge=");
// redirectUrl = redirectUrl.replace(/&nonce=.*/gi, "");
// }
return NextResponse.redirect(redirectUrl, {
headers: redirectHeaders,
})