@@ -7,10 +7,18 @@ export function restartFlowUrl(
77 request_url ?: string
88 requested_aal ?: string
99 return_to ?: string
10+ identity_schema ?: string
1011 } ,
1112 fallback : string ,
1213) {
13- return flow . request_url || appendReturnTo ( fallback , flow . return_to )
14+ return (
15+ flow . request_url ||
16+ appendReturnToAndIdentitySchema (
17+ fallback ,
18+ flow . return_to ,
19+ flow . identity_schema ,
20+ )
21+ )
1422}
1523
1624export function initFlowUrl (
@@ -20,6 +28,7 @@ export function initFlowUrl(
2028 id : string
2129 return_to ?: string
2230 oauth2_login_challenge ?: string
31+ identity_schema ?: string
2332 } ,
2433) {
2534 const result = `${ sdkUrl } /self-service/${ flowType } /browser`
@@ -28,6 +37,9 @@ export function initFlowUrl(
2837 if ( flow . oauth2_login_challenge ) {
2938 qs . set ( "login_challenge" , flow . oauth2_login_challenge )
3039 }
40+ if ( flow . identity_schema ) {
41+ qs . set ( "identity_schema" , flow . identity_schema )
42+ }
3143 if ( flow . return_to ) {
3244 qs . set ( "return_to" , flow . return_to )
3345 } else if ( typeof window !== "undefined" ) {
@@ -44,12 +56,17 @@ export function initFlowUrl(
4456 return result + "?" + qs . toString ( )
4557}
4658
47- function appendReturnTo ( url : string , returnTo ?: string ) {
48- if ( ! returnTo ) {
49- return url
50- }
51-
59+ function appendReturnToAndIdentitySchema (
60+ url : string ,
61+ returnTo ?: string ,
62+ identitySchema ?: string ,
63+ ) {
5264 const urlObj = new URL ( url )
53- urlObj . searchParams . set ( "return_to" , returnTo )
65+ if ( returnTo ) {
66+ urlObj . searchParams . set ( "return_to" , returnTo )
67+ }
68+ if ( identitySchema ) {
69+ urlObj . searchParams . set ( "identity_schema" , identitySchema )
70+ }
5471 return urlObj . toString ( )
5572}
0 commit comments