mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 08:23:16 +00:00
protocol for host, error handling
This commit is contained in:
@@ -64,6 +64,11 @@ export function SignInWithIdp({
|
||||
setLoading(false);
|
||||
});
|
||||
|
||||
if (response && "error" in response && response?.error) {
|
||||
setError(response.error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (response && "redirect" in response && response?.redirect) {
|
||||
return router.push(response.redirect);
|
||||
}
|
||||
|
||||
@@ -12,11 +12,15 @@ export type StartIDPFlowCommand = {
|
||||
export async function startIDPFlow(command: StartIDPFlowCommand) {
|
||||
const host = (await headers()).get("host");
|
||||
|
||||
if (!host) {
|
||||
return { error: "Could not get host" };
|
||||
}
|
||||
|
||||
return startIdentityProviderFlow({
|
||||
idpId: command.idpId,
|
||||
urls: {
|
||||
successUrl: `${host}${command.successUrl}`,
|
||||
failureUrl: `${host}${command.failureUrl}`,
|
||||
successUrl: `${host.includes("localhost") ? "http://" : "https://"}${host}${command.successUrl}`,
|
||||
failureUrl: `${host.includes("localhost") ? "http://" : "https://"}${host}${command.failureUrl}`,
|
||||
},
|
||||
}).then((response) => {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user