@@ -83,23 +83,26 @@ AuthorizeHandler.prototype.handle = function(request, response) {
83
83
}
84
84
85
85
var fns = [
86
- this . generateAuthorizationCode ( ) ,
87
86
this . getAuthorizationCodeLifetime ( ) ,
88
87
this . getClient ( request ) ,
89
88
this . getUser ( request , response )
90
89
] ;
91
90
92
91
return Promise . all ( fns )
93
92
. bind ( this )
94
- . spread ( function ( authorizationCode , expiresAt , client , user ) {
93
+ . spread ( function ( expiresAt , client , user ) {
95
94
var uri = this . getRedirectUri ( request , client ) ;
96
95
var scope ;
97
96
var state ;
98
97
var ResponseType ;
99
98
100
99
return Promise . bind ( this )
101
- . then ( function ( ) {
100
+ . then ( function ( ) {
102
101
scope = this . getScope ( request ) ;
102
+
103
+ return this . generateAuthorizationCode ( client , user , scope ) ;
104
+ } )
105
+ . then ( function ( authorizationCode ) {
103
106
state = this . getState ( request ) ;
104
107
ResponseType = this . getResponseType ( request ) ;
105
108
@@ -130,9 +133,9 @@ AuthorizeHandler.prototype.handle = function(request, response) {
130
133
* Generate authorization code.
131
134
*/
132
135
133
- AuthorizeHandler . prototype . generateAuthorizationCode = function ( ) {
136
+ AuthorizeHandler . prototype . generateAuthorizationCode = function ( client , user , scope ) {
134
137
if ( this . model . generateAuthorizationCode ) {
135
- return promisify ( this . model . generateAuthorizationCode ) ( ) ;
138
+ return promisify ( this . model . generateAuthorizationCode ) ( client , user , scope ) ;
136
139
}
137
140
return tokenUtil . generateRandomToken ( ) ;
138
141
} ;
0 commit comments