oauth2 icon indicating copy to clipboard operation
oauth2 copied to clipboard

Defaults to application/json when content-type header is not present

Open sheharyarn opened this issue 3 years ago • 2 comments

Thanks for the amazing library! I came across a bug and wanted to report:

The OAuth2 library defaults to application/json response type when no content-type header is present. Since the Response module calls serializer.decode!(body), this causes an exception (as expected) since the body being decoded is probably not JSON.

The default should probably be text/plain and it should return the body as-is. On a side note, you should probably use Plug's implementation of extracting content-type, so it correctly parses even when there is extra metadata attached.

(For reference, I'm having this issue with the Zendesk API where some API responses don't have the content-type header).

sheharyarn avatar Aug 25 '21 23:08 sheharyarn

I'm here to +1 this, we've had an issue with Auth0 today and we've run into the same issue. I'm happy to contribute some code if you would like help on this!

andyleclair avatar Dec 16 '21 20:12 andyleclair

I agree with this, but I am not sure how much of a breaking change would be and the potential downsides of it, I think it will be prudent to try to have some answer for such concern or at the very least a backup plan or guidelines for peeps facing the potential issue with it.

@ueberauth/developers any thoughts on the subject?

yordis avatar Jul 08 '22 17:07 yordis

This issue has been automatically marked as "stale:discard". If this issue still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment.

github-actions[bot] avatar Feb 07 '24 02:02 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!

github-actions[bot] avatar Feb 22 '24 02:02 github-actions[bot]