authurl from idp as nextstep

This commit is contained in:
peintnermax
2024-07-25 16:09:08 +02:00
parent f457fad600
commit 6e594ee95b
3 changed files with 11 additions and 3 deletions

View File

@@ -99,6 +99,10 @@ export async function POST(request: NextRequest) {
`${host}/idp/${provider}/failure?` +
new URLSearchParams(params),
},
}).then((resp: any) => {
if (resp.authUrl) {
return NextResponse.json({ nextStep: resp.authUrl });
}
});
}
} else if (
@@ -119,7 +123,7 @@ export async function POST(request: NextRequest) {
);
return NextResponse.json({
nextUrl: registerUrl,
nextStep: registerUrl,
status: 200,
});
}

View File

@@ -181,6 +181,10 @@ export async function GET(request: NextRequest) {
`${host}/idp/${provider}/failure?` +
new URLSearchParams(params),
},
}).then((resp: any) => {
if (resp.authUrl) {
return NextResponse.redirect(resp.authUrl);
}
});
}
}

View File

@@ -83,8 +83,8 @@ export default function UsernameForm({
organization?: string,
) {
return submitLoginName(values, organization).then((response) => {
if (response.nextUrl) {
return router.push(response.nextUrl);
if (response.nextStep) {
return router.push(response.nextStep);
} else if (response.authMethodTypes.length == 1) {
const method = response.authMethodTypes[0];
switch (method) {