0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/.changeset/tiny-fishes-bake.md
simeng-li 8beb758771
refactor(core): refactor oidc error response query param (#6525)
refactor oidc error reponse query param
2024-08-28 10:14:04 +08:00

942 B

@logto/core
patch

introduce new parse_error query parameter flag. The value of parse_error can only be false.

By default, Logto returns the parsed error code and error description in all the RequestError error responses. This is to ensure the error responses are consistent and easy to understand.

However, when integrating Logto with Google OAuth, the error response body containing code will be rejected by Google. code is considered as a reserved OIDC key, can't be used as the error code key in the error response body.

To workaround this, we add a new parse_error query parameter flag. When parsing the OIDC error body, if the parse_error is set to false, only oidc error body will be returned.

example:

curl -X POST "http://localhost:3001/oidc/token?parse_error=false"
{
  "error": "invalid_grant",
  "error_description": "Invalid value for parameter 'code': 'invalid_code'."
}