@@ -61,6 +61,7 @@ class TokenHandler {
6161 this . allowExtendedTokenAttributes = options . allowExtendedTokenAttributes ;
6262 this . requireClientAuthentication = options . requireClientAuthentication || { } ;
6363 this . alwaysIssueNewRefreshToken = options . alwaysIssueNewRefreshToken !== false ;
64+ this . requestProcessor = options . requestProcessor ;
6465 }
6566
6667 /**
@@ -85,8 +86,13 @@ class TokenHandler {
8586 }
8687
8788 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 req = new Request ( {
91+ ...request ,
92+ body,
93+ } ) ;
94+ const client = await this . getClient ( req , response ) ;
95+ const data = await this . handleGrantType ( req , client ) ;
9096 const model = new TokenModel ( data , { allowExtendedTokenAttributes : this . allowExtendedTokenAttributes } ) ;
9197 const tokenType = this . getTokenType ( model ) ;
9298
@@ -247,7 +253,7 @@ class TokenHandler {
247253 accessTokenLifetime : accessTokenLifetime ,
248254 model : this . model ,
249255 refreshTokenLifetime : refreshTokenLifetime ,
250- alwaysIssueNewRefreshToken : this . alwaysIssueNewRefreshToken
256+ alwaysIssueNewRefreshToken : this . alwaysIssueNewRefreshToken ,
251257 } ;
252258
253259 return new Type ( options ) . handle ( request , client ) ;
0 commit comments