File tree Expand file tree Collapse file tree 1 file changed +22
-11
lines changed Expand file tree Collapse file tree 1 file changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -28,20 +28,31 @@ export async function getOAuth2RedirectUrl(
28
28
config : OAuthParams ,
29
29
req : Request ,
30
30
res : Response ,
31
+ addState : boolean = true ,
31
32
) : Promise < string > {
32
33
try {
33
34
const nonce_string : string = Security . Nonce . nonce ( ) ;
34
- const state = JSON . stringify ( {
35
- nonce : nonce_string ,
36
- accessTokenUrl : config . accesTokenUrl ,
37
- apiUrl : config . apiUrl ,
38
- } ) ;
39
- const searchParamsAuth = new URLSearchParams ( {
40
- response_type : 'code' ,
41
- redirect_uri : config . redirect_uri ,
42
- client_id : config . client_id ,
43
- state,
44
- } ) ;
35
+ let searchParams ;
36
+ if ( addState ) {
37
+ const state = JSON . stringify ( {
38
+ nonce : nonce_string ,
39
+ accessTokenUrl : config . accesTokenUrl ,
40
+ apiUrl : config . apiUrl ,
41
+ } ) ;
42
+ searchParams = {
43
+ response_type : 'code' ,
44
+ redirect_uri : config . redirect_uri ,
45
+ client_id : config . client_id ,
46
+ state,
47
+ } ;
48
+ } else {
49
+ searchParams = {
50
+ response_type : 'code' ,
51
+ redirect_uri : config . redirect_uri ,
52
+ client_id : config . client_id ,
53
+ } ;
54
+ }
55
+ const searchParamsAuth = new URLSearchParams ( searchParams ) ;
45
56
Security . Nonce . setNonceCookie (
46
57
req ,
47
58
res ,
You can’t perform that action at this time.
0 commit comments