Software /
code /
prosody-modules
Comparison
mod_http_oauth2/mod_http_oauth2.lua @ 5471:d4d333cb75b2
mod_http_oauth2: Clarify some error messages
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 18 May 2023 13:24:18 +0200 |
parent | 5470:40c990159006 |
child | 5472:b80b6947b079 |
comparison
equal
deleted
inserted
replaced
5470:40c990159006 | 5471:d4d333cb75b2 |
---|---|
686 local params = http.formdecode(request.url.query); | 686 local params = http.formdecode(request.url.query); |
687 if not params then | 687 if not params then |
688 return error_response(request, oauth_error("invalid_request", "Invalid query parameters")); | 688 return error_response(request, oauth_error("invalid_request", "Invalid query parameters")); |
689 end | 689 end |
690 | 690 |
691 if not params.client_id then return oauth_error("invalid_request", "missing 'client_id'"); end | 691 if not params.client_id then |
692 return oauth_error("invalid_request", "Missing 'client_id' parameter"); | |
693 end | |
692 | 694 |
693 local ok, client = verify_client(params.client_id); | 695 local ok, client = verify_client(params.client_id); |
694 | 696 |
695 if not ok then | 697 if not ok then |
696 return oauth_error("invalid_client", "incorrect credentials"); | 698 return oauth_error("invalid_request", "Invalid 'client_id' parameter"); |
697 end | 699 end |
698 | 700 |
699 local client_response_types = set.new(array(client.response_types or { "code" })); | 701 local client_response_types = set.new(array(client.response_types or { "code" })); |
700 client_response_types = set.intersection(client_response_types, allowed_response_type_handlers); | 702 client_response_types = set.intersection(client_response_types, allowed_response_type_handlers); |
701 if not client_response_types:contains(params.response_type) then | 703 if not client_response_types:contains(params.response_type) then |
702 return oauth_error("invalid_client", "response_type not allowed"); | 704 return oauth_error("invalid_client", "'response_type' not allowed"); |
703 end | 705 end |
704 | 706 |
705 local requested_scopes = parse_scopes(params.scope or ""); | 707 local requested_scopes = parse_scopes(params.scope or ""); |
706 if client.scope then | 708 if client.scope then |
707 local client_scopes = set.new(parse_scopes(client.scope)); | 709 local client_scopes = set.new(parse_scopes(client.scope)); |