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