You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before parsing the OAuth response with oauthResponseSchema, we should first check oauthResponse.status to pass more useful error messaging to library consumers.
For example, if a consumer's redirect_uri is accidentally misconfigured, the code below throws an invalid access token response error instead of displaying a more useful redirect_uri_mismatch error.
Error responses are returned as either a 400 Bad Request or 403 Forbidden and contain a JSON body with an error and optional error_description property:
HTTP/1.1 400 Bad RequestContent-Type: application/json
{
"error": "invalid_client",
"error_description": "Parameter client_secret does not match"
}
Invalid code:
HTTP/1.1 400 Bad RequestContent-Type: application/json
{ "error": "Invalid code." }
Invalid context:
HTTP/1.1 403 ForbiddenContent-Type: application/json
{
"error": "Only store owners may install or update apps. Please contact the store owner for assistance"
}
Invalid scope:
HTTP/1.1 400 Bad RequestContent-Type: application/json
{ "error": "Invalid scope(s)." }
Invalid grant_type:
HTTP/1.1 400 Bad RequestContent-Type: application/json
{
"error": "unsupported_grant_type",
"error_description": "The grant type authorization_codea is not recognized"
}
Invalid redirect_uri:
HTTP/1.1 400 Bad RequestContent-Type: application/json
{
"error": "redirect_uri_mismatch",
"error_description": "Parameter redirect_uri does not match registered URI"
}
Acceptance Criteria:
Log HTTP status code
Log HTTP status text
Log parsed JSON body
The text was updated successfully, but these errors were encountered:
Before parsing the OAuth response with
oauthResponseSchema
, we should first checkoauthResponse.status
to pass more useful error messaging to library consumers.For example, if a consumer's
redirect_uri
is accidentally misconfigured, the code below throws aninvalid access token response
error instead of displaying a more usefulredirect_uri_mismatch
error.bigrequest/packages/bigrequest/src/oauth.ts
Lines 40 to 69 in 0e50eeb
Error responses are returned as either a
400 Bad Request
or403 Forbidden
and contain a JSON body with anerror
and optionalerror_description
property:Invalid
client_id
:Invalid
client_secret
:Invalid
code
:Invalid
context
:Invalid
scope
:Invalid
grant_type
:Invalid
redirect_uri
:Acceptance Criteria:
The text was updated successfully, but these errors were encountered: