@@ -61,6 +61,7 @@ class TokenHandler {
61
61
this . allowExtendedTokenAttributes = options . allowExtendedTokenAttributes ;
62
62
this . requireClientAuthentication = options . requireClientAuthentication || { } ;
63
63
this . alwaysIssueNewRefreshToken = options . alwaysIssueNewRefreshToken !== false ;
64
+ this . requestProcessor = options . requestProcessor ?? ( ( req ) => req . body ) ;
64
65
}
65
66
66
67
/**
@@ -85,8 +86,15 @@ class TokenHandler {
85
86
}
86
87
87
88
try {
88
- const client = await this . getClient ( request , response ) ;
89
- const data = await this . handleGrantType ( request , client ) ;
89
+ const body = this . requestProcessor ( request ) ?? request . body ;
90
+ const client = await this . getClient ( {
91
+ ...request ,
92
+ body,
93
+ } , response ) ;
94
+ const data = await this . handleGrantType ( {
95
+ ...request ,
96
+ body,
97
+ } , client ) ;
90
98
const model = new TokenModel ( data , { allowExtendedTokenAttributes : this . allowExtendedTokenAttributes } ) ;
91
99
const tokenType = this . getTokenType ( model ) ;
92
100
@@ -247,7 +255,7 @@ class TokenHandler {
247
255
accessTokenLifetime : accessTokenLifetime ,
248
256
model : this . model ,
249
257
refreshTokenLifetime : refreshTokenLifetime ,
250
- alwaysIssueNewRefreshToken : this . alwaysIssueNewRefreshToken
258
+ alwaysIssueNewRefreshToken : this . alwaysIssueNewRefreshToken ,
251
259
} ;
252
260
253
261
return new Type ( options ) . handle ( request , client ) ;
0 commit comments