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

Set content type "application/x-www-form-urlencoded" when returning tokens to client #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mattbsea
Copy link

@mattbsea mattbsea commented Aug 7, 2020

https://tools.ietf.org/html/rfc5849#page-9

RFC 5849 requires or at least strongly suggests that tokens be returned with content type "application/x-www-form-urlencoded"

From Section 2.1:
"The server MUST verify (Section 3.2) the request and if valid,
respond back to the client with a set of temporary credentials (in
the form of an identifier and shared-secret). The temporary
credentials are included in the HTTP response body using the
"application/x-www-form-urlencoded" content type as defined by
[W3C.REC-html40-19980424] with a 200 status code (OK)."

I believe the MUST applies to the 2nd sentence as well. The first sentence declares the server MUST respond with temporary credentials. The 2nd sentence goes on to clarify that the credentials "are included in the HTTP response body using the "application/x-www-form-urlencoded" content type"

Additionally, every example given in the RFC uses "application/x-www-form-urlencoded"

oauth-plugin currently returns content type "text/plain". This causes a problem in clients who enforce strict adherence to the RFC's content-type "application/x-www-form-urlencoded"

NB: I'm not a rails developer. I discovered this when working with the Qt Framework OAuth1 client. The code changes in this PR have not been tested.

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

Successfully merging this pull request may close these issues.

1 participant