Comparison

mod_http_oauth2/mod_http_oauth2.lua @ 5225:3439eb37f23b

mod_http_oauth2: token endpoint: handle missing credentials
author Matthew Wild <mwild1@gmail.com>
date Tue, 07 Mar 2023 15:33:07 +0000
parent 5224:cd5cf4cc6304
child 5228:77cd01af06a9
comparison
equal deleted inserted replaced
5224:cd5cf4cc6304 5225:3439eb37f23b
464 local params = http.formdecode(event.request.body); 464 local params = http.formdecode(event.request.body);
465 if not params then 465 if not params then
466 return error_response(event.request, oauth_error("invalid_request")); 466 return error_response(event.request, oauth_error("invalid_request"));
467 end 467 end
468 468
469 if credentials.type == "basic" then 469 if credentials and credentials.type == "basic" then
470 params.client_id = http.urldecode(credentials.username); 470 params.client_id = http.urldecode(credentials.username);
471 params.client_secret = http.urldecode(credentials.password); 471 params.client_secret = http.urldecode(credentials.password);
472 end 472 end
473 473
474 local grant_type = params.grant_type 474 local grant_type = params.grant_type