File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,12 @@ OAuth2Strategy.prototype.authenticate = function(req, options) {
141
141
callbackURL = url . resolve ( utils . originalURL ( req , { proxy : this . _trustProxy } ) , callbackURL ) ;
142
142
}
143
143
}
144
+
145
+ var meta = {
146
+ authorizationURL : this . _oauth2 . _authorizeUrl ,
147
+ tokenURL : this . _oauth2 . _accessTokenUrl ,
148
+ clientID : this . _oauth2 . _clientId
149
+ }
144
150
145
151
if ( req . query && req . query . code ) {
146
152
var state = req . query . state ;
@@ -208,13 +214,26 @@ OAuth2Strategy.prototype.authenticate = function(req, options) {
208
214
var location = this . _oauth2 . getAuthorizeUrl ( params ) ;
209
215
this . redirect ( location ) ;
210
216
} else {
211
- this . _stateStore . store ( req , function ( err , state ) {
217
+ function stored ( err , state ) {
212
218
if ( err ) { return self . error ( err ) ; }
213
219
214
220
if ( state ) { params . state = state ; }
215
221
var location = self . _oauth2 . getAuthorizeUrl ( params ) ;
216
222
self . redirect ( location ) ;
217
- } ) ;
223
+ }
224
+
225
+ try {
226
+ var arity = this . _stateStore . store . length ;
227
+ if ( arity == 3 ) {
228
+ this . _stateStore . store ( req , meta , stored ) ;
229
+ } else { // arity == 2
230
+ this . _stateStore . store ( req , stored ) ;
231
+ }
232
+
233
+
234
+ } catch ( ex ) {
235
+ return this . error ( ex ) ;
236
+ }
218
237
}
219
238
}
220
239
} ;
You can’t perform that action at this time.
0 commit comments