diff --git a/apps/login/src/app/login/route.ts b/apps/login/src/app/login/route.ts index 9b05ffb2f0e..582ccff05c0 100644 --- a/apps/login/src/app/login/route.ts +++ b/apps/login/src/app/login/route.ts @@ -139,16 +139,12 @@ export async function GET(request: NextRequest) { const matched = IDP_SCOPE_REGEX.exec(idpScope); idpId = matched?.[1] ?? ""; - console.log("idpId", idpId, organization ? organization : undefined); - const identityProviders = await getActiveIdentityProviders( organization ? organization : undefined, ).then((resp) => { return resp.identityProviders; }); - console.log("idps", JSON.stringify(identityProviders)); - const idp = identityProviders.find((idp) => idp.id === idpId); if (idp) { @@ -177,10 +173,6 @@ export async function GET(request: NextRequest) { params.set("organization", organization); } - console.log( - `${host}/idp/${provider}/success?` + new URLSearchParams(params), - ); - return startIdentityProviderFlow({ idpId, urls: { @@ -191,10 +183,12 @@ export async function GET(request: NextRequest) { `${host}/idp/${provider}/failure?` + new URLSearchParams(params), }, - }).then((resp: any) => { - console.log(resp); - if (resp.authUrl) { - return NextResponse.redirect(resp.authUrl); + }).then((resp) => { + if ( + resp.nextStep.value && + typeof resp.nextStep.value === "string" + ) { + return NextResponse.redirect(resp.nextStep.value); } }); }