@@ -33,6 +33,7 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig }: A
33
33
// Create a router to apply middleware
34
34
const router = express . Router ( ) ;
35
35
router . use ( allowedMethods ( [ "GET" , "POST" ] ) ) ;
36
+ router . use ( express . urlencoded ( { extended : false } ) ) ;
36
37
37
38
// Apply rate limiting unless explicitly disabled
38
39
if ( rateLimitConfig !== false ) {
@@ -53,7 +54,8 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig }: A
53
54
router . all ( "/" , async ( req , res ) => {
54
55
let client_id , redirect_uri ;
55
56
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 ) ) ;
57
59
} catch ( error ) {
58
60
res . status ( 400 ) . end ( `Bad Request: ${ error } ` ) ;
59
61
return ;
@@ -79,7 +81,8 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig }: A
79
81
80
82
let params ;
81
83
try {
82
- params = RequestAuthorizationParamsSchema . parse ( req . query ) ;
84
+ const authData = req . method === 'POST' ? req . body : req . query ;
85
+ params = RequestAuthorizationParamsSchema . parse ( authData ) ;
83
86
} catch ( error ) {
84
87
const errorUrl = new URL ( redirect_uri ) ;
85
88
errorUrl . searchParams . set ( "error" , "invalid_request" ) ;
0 commit comments