[FEATURE]: Provide guidance for handling failures to access a protected resource #744
dave-shawley
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there an existing ticket for this?
Is your feature request related to a problem? Please describe
Handling token-related failures to access a protected resource is difficult since there number of
error
values is limited. Consider the following two error responses for a token related failure.and
The requestor should refresh the access token in the first case and re-establish the customer connection in the second case. The key error indicator for OAuth resource responses is the
error
which is somewhat limited.Describe the solution you'd like
Provide guidance on how to disambiguate error responses inside of computer programs.
RFC-6749 established a registry of well-known values that the OAuth-related responses can use for the
error
value. The registry is maintained by the IETF and published by the IANA:https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#extensions-error
The API could be changed to return
expired_token
for expired access tokens and continue to returninvalid_token
in the case where the token is actually invalid.Describe any alternatives you've considered
The other option that I considered was using well-known
error_uri
values. RFC-6749 includes the optionalerror_uri
parameter which is described in section 5.2 as:You could use the
error_uri
to indicate the specific error as well as target a "help" page as long as the URI doesn't change. For example, you could document the behavior at "https://developers.etsy.com/documentation/essentials/requests#auth-expired" and then use that as the well-knownerror_uri
in the error response bodies. This would allow for error responses like the following to be clearly differentiated by the requestor.and
Additional context
My current codebase looks for the word "expired" in the
error_description
to disambiguate the two cases.I posed this question in the etsy-api-v2 Google group as well -- https://groups.google.com/g/etsy-api-v2/c/UlE-jlBglcE/m/DFrdV8LUAAAJ
Beta Was this translation helpful? Give feedback.
All reactions