@@ -83,23 +83,26 @@ AuthorizeHandler.prototype.handle = function(request, response) {
8383 }
8484
8585 var fns = [
86- this . generateAuthorizationCode ( ) ,
8786 this . getAuthorizationCodeLifetime ( ) ,
8887 this . getClient ( request ) ,
8988 this . getUser ( request , response )
9089 ] ;
9190
9291 return Promise . all ( fns )
9392 . bind ( this )
94- . spread ( function ( authorizationCode , expiresAt , client , user ) {
93+ . spread ( function ( expiresAt , client , user ) {
9594 var uri = this . getRedirectUri ( request , client ) ;
9695 var scope ;
9796 var state ;
9897 var ResponseType ;
9998
10099 return Promise . bind ( this )
101- . then ( function ( ) {
100+ . then ( function ( ) {
102101 scope = this . getScope ( request ) ;
102+
103+ return this . generateAuthorizationCode ( client , user , scope ) ;
104+ } )
105+ . then ( function ( authorizationCode ) {
103106 state = this . getState ( request ) ;
104107 ResponseType = this . getResponseType ( request ) ;
105108
@@ -130,9 +133,9 @@ AuthorizeHandler.prototype.handle = function(request, response) {
130133 * Generate authorization code.
131134 */
132135
133- AuthorizeHandler . prototype . generateAuthorizationCode = function ( ) {
136+ AuthorizeHandler . prototype . generateAuthorizationCode = function ( client , user , scope ) {
134137 if ( this . model . generateAuthorizationCode ) {
135- return promisify ( this . model . generateAuthorizationCode ) ( ) ;
138+ return promisify ( this . model . generateAuthorizationCode ) ( client , user , scope ) ;
136139 }
137140 return tokenUtil . generateRandomToken ( ) ;
138141} ;
0 commit comments