@@ -33,6 +33,7 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig }: A
3333 // Create a router to apply middleware 
3434 const  router  =  express . Router ( ) ; 
3535 router . use ( allowedMethods ( [ "GET" ,  "POST" ] ) ) ; 
36+  router . use ( express . urlencoded ( {  extended : false  } ) ) ; 
3637
3738 // Apply rate limiting unless explicitly disabled 
3839 if  ( rateLimitConfig  !==  false )  { 
@@ -53,7 +54,8 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig }: A
5354 router . all ( "/" ,  async  ( req ,  res )  =>  { 
5455 let  client_id ,  redirect_uri ; 
5556 try  { 
56-  ( {  client_id,  redirect_uri }  =  ClientAuthorizationParamsSchema . parse ( req . query ) ) ; 
57+  const  data  =  req . method  ===  'POST'  ? req . body  : req . query ; 
58+  ( {  client_id,  redirect_uri }  =  ClientAuthorizationParamsSchema . parse ( data ) ) ; 
5759 }  catch  ( error )  { 
5860 res . status ( 400 ) . end ( `Bad Request: ${ error }  ) ; 
5961 return ; 
@@ -79,7 +81,8 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig }: A
7981
8082 let  params ; 
8183 try  { 
82-  params  =  RequestAuthorizationParamsSchema . parse ( req . query ) ; 
84+  const  authData  =  req . method  ===  'POST'  ? req . body  : req . query ; 
85+  params  =  RequestAuthorizationParamsSchema . parse ( authData ) ; 
8386 }  catch  ( error )  { 
8487 const  errorUrl  =  new  URL ( redirect_uri ) ; 
8588 errorUrl . searchParams . set ( "error" ,  "invalid_request" ) ; 
0 commit comments