Set content type "application/x-www-form-urlencoded" when returning tokens to client #161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.