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

Accept params in the POST body as JSON #60

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bugant
Copy link

@bugant bugant commented Aug 29, 2013

When creating a token accept params passed as JSON in the POST body

Matteo Centenaro added 2 commits August 29, 2013 18:37
When creating a token accept params passed as JSON in the POST body
@jcoglan
Copy link
Contributor

jcoglan commented Aug 29, 2013

Where in the spec (this library implements draft-10) is it mandated that the provider server accept input as application/json?

@bugant
Copy link
Author

bugant commented Aug 30, 2013

It is indeed not mentioned in draft-10, though it could be useful. For example, ember-auth (https://github.com/heartsentwined/ember-auth) sends authorization requests in JSON format.

@skunkworker
Copy link

This would be very useful.

@skunkworker
Copy link

you may want to change

if media_type  == 'application/json'

to

if media_type  == 'application/json' && env['rack.input'].read.length > 0

Because if you are using it to authenticate an api, and a regular get request it will throw the error "json length must be at least two octets"

@jcoglan
Copy link
Contributor

jcoglan commented Sep 27, 2013

It may be very useful but it's not in the spec, and I think spec implementations should stick to what's documented so that people actually know what they do and aren't surprised.

If you want a JSON frontend, this can be quite easily done using a proxy or some Rack middleware.

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.

3 participants