@@ -38,7 +38,7 @@ function AbstractGrantType(options) {
3838
3939AbstractGrantType . prototype . generateAccessToken = function ( client , user , scope ) {
4040 if ( this . model . generateAccessToken ) {
41- return promisify ( this . model . generateAccessToken , 3 ) ( client , user , scope )
41+ return promisify ( this . model . generateAccessToken , 3 ) . call ( this . model , client , user , scope )
4242 . then ( function ( accessToken ) {
4343 return accessToken || tokenUtil . generateRandomToken ( ) ;
4444 } ) ;
@@ -53,7 +53,7 @@ AbstractGrantType.prototype.generateAccessToken = function(client, user, scope)
5353
5454AbstractGrantType . prototype . generateRefreshToken = function ( client , user , scope ) {
5555 if ( this . model . generateRefreshToken ) {
56- return promisify ( this . model . generateRefreshToken , 3 ) ( client , user , scope )
56+ return promisify ( this . model . generateRefreshToken , 3 ) . call ( this . model , client , user , scope )
5757 . then ( function ( refreshToken ) {
5858 return refreshToken || tokenUtil . generateRandomToken ( ) ;
5959 } ) ;
@@ -103,7 +103,7 @@ AbstractGrantType.prototype.getScope = function(request) {
103103 */
104104AbstractGrantType . prototype . validateScope = function ( user , client , scope ) {
105105 if ( this . model . validateScope ) {
106- return promisify ( this . model . validateScope , 3 ) ( user , client , scope )
106+ return promisify ( this . model . validateScope , 3 ) . call ( this . model , user , client , scope )
107107 . then ( function ( scope ) {
108108 if ( ! scope ) {
109109 throw new InvalidScopeError ( 'Invalid scope: Requested scope is invalid' ) ;
0 commit comments