File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ export default class Oauth2Scheme {
64
64
return this . $auth . reset ( )
65
65
}
66
66
67
- login ( { params } = { } ) {
67
+ login ( { params, state , nonce } = { } ) {
68
68
const opts = {
69
69
protocol : 'oauth2' ,
70
70
response_type : this . options . response_type ,
@@ -73,7 +73,7 @@ export default class Oauth2Scheme {
73
73
scope : this . _scope ,
74
74
// Note: The primary reason for using the state parameter is to mitigate CSRF attacks.
75
75
// https://auth0.com/docs/protocols/oauth2/oauth-state
76
- state : nanoid ( ) ,
76
+ state : state || nanoid ( ) ,
77
77
...params
78
78
}
79
79
@@ -87,7 +87,7 @@ export default class Oauth2Scheme {
87
87
if ( opts . response_type . includes ( 'id_token' ) ) {
88
88
// nanoid auto-generates an URL Friendly, unique Cryptographic string
89
89
// Recommended by Auth0 on https://auth0.com/docs/api-auth/tutorials/nonce
90
- opts . nonce = nanoid ( )
90
+ opts . nonce = nonce || nanoid ( )
91
91
}
92
92
93
93
this . $auth . $storage . setLocalStorage ( this . name + '.state' , opts . state )
You can’t perform that action at this time.
0 commit comments