File tree Expand file tree Collapse file tree 4 files changed +11
-3
lines changed Expand file tree Collapse file tree 4 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -292,8 +292,10 @@ export abstract class AuthCodeAbstract {
292
292
lang,
293
293
login_hint : loginHint ,
294
294
connection_id : connectionId ,
295
+ state,
295
296
...rest
296
297
} = options . authUrlParams ;
298
+
297
299
searchParamsObject = { ...rest , ...searchParamsObject } ;
298
300
299
301
if ( lang ) {
Original file line number Diff line number Diff line change @@ -47,7 +47,10 @@ export class AuthCodeWithPKCE extends AuthCodeAbstract {
47
47
this . codeChallenge = challenge ;
48
48
this . codeVerifier = verifier ;
49
49
50
- this . state = options . state ?? utilities . generateRandomString ( ) ;
50
+ const providedState = options . state ?? options . authUrlParams ?. state ;
51
+
52
+ this . state = providedState ?? utilities . generateRandomString ( ) ;
53
+
51
54
const setItem = isBrowserEnvironment ( )
52
55
? ( sessionManager as unknown as BrowserSessionManager ) . setSessionItemBrowser
53
56
: sessionManager . setSessionItem ;
Original file line number Diff line number Diff line change @@ -36,12 +36,15 @@ export class AuthorizationCode extends AuthCodeAbstract {
36
36
sessionManager : SessionManager ,
37
37
options : AuthURLOptions = { }
38
38
) : Promise < URL > {
39
+ const providedState = options . state ?? options . authUrlParams ?. state ;
40
+
39
41
this . state =
40
- options . state ??
42
+ providedState ??
41
43
( ( await sessionManager . getSessionItem (
42
44
AuthorizationCode . STATE_KEY
43
45
) ) as string ) ??
44
46
utilities . generateRandomString ( ) ;
47
+
45
48
await sessionManager . setSessionItem ( AuthorizationCode . STATE_KEY , this . state ) ;
46
49
const authURL = new URL ( this . authorizationEndpoint ) ;
47
50
const authParams = this . generateAuthURLParams ( options ) ;
Original file line number Diff line number Diff line change 26
26
"postbuild" : " node sdk-version.js clean && ncp ./package-cjs.json ./dist-cjs/package.json && ncp ./package-esm.json ./dist/package.json" ,
27
27
"prebuild" : " node sdk-version.js && rimraf dist dist-cjs lib/models lib/apis" ,
28
28
"lint" : " eslint . && prettier . --check" ,
29
- "lint:fix" : " eslint --fix . && prettier . --check " ,
29
+ "lint:fix" : " eslint --fix . && prettier . --write " ,
30
30
"test" : " jest --passWithNoTests" ,
31
31
"lint-staged" : " lint-staged" ,
32
32
"husky" : " husky install" ,
You can’t perform that action at this time.
0 commit comments