bshaffer / oauth2-server-php-docs

documentation for the oauth2-server-php library
231 stars 148 forks source link

Token can not be sent as JSON #16

Closed restfulify closed 10 years ago

restfulify commented 10 years ago

Hi there,

I think the token can not be sent as JSON. Is that right?

Greetings Tim

bshaffer commented 10 years ago

This is "OK" to do, but yes currently the library only looks for parameters using form-enctype. If you need to use JSON in your application, extend the OAuth2\Request object to handle this.

bshaffer commented 10 years ago

Actually, I lied. The OAuth2\Request object looks at the headers, and if Content-Type is set to application/json, the request is decoded using json_decode, which means the token would be parsed if submitted in JSON.

Additionally, if you use oauth2-server-httpfoundation-bridge, you can submit requests using symfony's HTTPFoundation bundle, which also has JSON support (and is a more comprehensive library than the request object included here)