Closed angelikatyborska closed 1 year ago
Hey there, are you able to contribute and fix the situation?
{:error, %OAuth2.Response{body: %{"error" => error} = response} ->
description = response.body["error_description"] || "....."
# or please check what could be a better description or if we should use an empty string instead
{:error, {error, description}}
Yes, I or somebody else from my team can open a PR for this and probably also for a very similar issue https://github.com/ueberauth/ueberauth_google/issues/94. Give us a day or two 🙂
You got this! Let me know if you need help from me!
Steps to Reproduce
In our error tracker, we get sometimes see a
CaseClauseError
inUeberauth.Strategy.Google.OAuth.get_access_token/2
when Google responds with a 503 error. The response's body only has an"error"
key, but doesn't have the"error_description"
key. Since this is an internal error from Google, we cannot reproduce it ourselves. The response looks like this:It fails to be matched against one of the patters from https://github.com/ueberauth/ueberauth_google/blob/fdd44cdaa219903367c2fc6bc03d933f5ad737db/lib/ueberauth/strategy/google/oauth.ex#L55-L66
Expected Result
The
get_access_token
function returns a well formatted error like in case of other handled error responses. Since the error description is missing in the response, the short error code could be repeated in place of the description.Actual Result
A
CaseClauseError
is raised.