File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
sign-in-with-esignet/src/lib/SignInWithEsignet Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ interface OidcConfigProp {
19
19
}
20
20
21
21
interface CallbackFunctionProp {
22
- ( clientId : string ) : Promise < string > ;
22
+ ( clientId : string , state ?: string , ui_locales ?: string ) : Promise < string > ;
23
23
}
24
24
25
25
interface ButtonConfigProp {
Original file line number Diff line number Diff line change @@ -381,13 +381,6 @@ function buildErrorRedirectUrl(
381
381
) } &error=${ encodeURIComponent ( errorCode ) } `;
382
382
}
383
383
384
- function extractRequestUriValue ( requestUri : string ) : string {
385
- if ( requestUri && requestUri . includes ( ":" ) ) {
386
- return requestUri . substring ( requestUri . lastIndexOf ( ":" ) + 1 ) ;
387
- }
388
- return requestUri ;
389
- }
390
-
391
384
function promiseWithTimeout < T > (
392
385
promise : Promise < T > ,
393
386
ms : number
@@ -408,7 +401,11 @@ async function par_callback(
408
401
return errorMessage . clientIdMissing ;
409
402
}
410
403
try {
411
- return await callbackFunction ( oidcConfig . client_id ) ;
404
+ return await callbackFunction (
405
+ oidcConfig . client_id ,
406
+ oidcConfig . state ,
407
+ oidcConfig . ui_locales
408
+ ) ;
412
409
} catch ( error ) {
413
410
return errorMessage . requestUriFailed ;
414
411
}
@@ -451,8 +448,11 @@ const SignInWithEsignet = async ({
451
448
typeof result === "string" &&
452
449
result . startsWith ( "urn:ietf:params:oauth:request_uri:" )
453
450
) {
454
- const requestUriValue = extractRequestUriValue ( result ) ;
455
- urlToNavigate = `${ oidcConfig . authorizeUri } ?client_id=${ oidcConfig . client_id } &request_uri=${ requestUriValue } ` ;
451
+ urlToNavigate = `${
452
+ oidcConfig . authorizeUri
453
+ } ?client_id=${ encodeURIComponent (
454
+ oidcConfig . client_id
455
+ ) } &request_uri=${ encodeURIComponent ( result ) } `;
456
456
window . location . href = urlToNavigate ;
457
457
return ;
458
458
}
You can’t perform that action at this time.
0 commit comments