Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access token response parsing with empty error_description string. #247

Closed
markst opened this issue Nov 24, 2017 · 2 comments
Closed

Access token response parsing with empty error_description string. #247

markst opened this issue Nov 24, 2017 · 2 comments

Comments

@markst
Copy link

markst commented Nov 24, 2017

Apologies if this a server side issue we need to resolve.

Our OAuth server returns the following response when using invalid credentials:

{"error_description":"","error":"access_denied"}

OAuth2Base.assureNoErrorInResponse will check for presence of error_description and throws a OAuth2Error. This then results in being unable to present an appropriate error message.

If I change the order of assureNoErrorInResponse error checks so that presence of params["error"] has precedence over error_description. I can display the appropriate error.

Is there any way of getting additional data from the OAuth2Error which I might be able to retrieve the access_denied error state?

@p2
Copy link
Owner

p2 commented Nov 24, 2017

Yes, so if error_description is present it's preferred.

If you control the server you can remove it if it's empty (since it's useless) or you could create a pull request so that OAuth2 only prefers error_description if it's actually longer than 0 characters, something like: if let err_msg = params["error_description"] as? String, err_msg.count > 0 { in OAuth2Base.assureNoErrorInResponse.

p2 added a commit that referenced this issue Nov 25, 2017
@p2 p2 closed this as completed in 7075dbd Nov 25, 2017
@markst
Copy link
Author

markst commented Nov 27, 2017

thanks p2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants