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

Make api requests with access_token in the Authorization header #185

Closed
Sydney-o9 opened this issue Sep 12, 2013 · 3 comments
Closed

Make api requests with access_token in the Authorization header #185

Sydney-o9 opened this issue Sep 12, 2013 · 3 comments

Comments

@Sydney-o9
Copy link

As shown here, it isn't a good idea to hold sensitive data (like a token) in querystring parameters.

Therefore, I tried to make api request with the access_token in the Authorization header (which was suggested here.
When trying to do so, I get the following error:

{
    "error": "access_denied",
    "error_description": "OAuth2 authentication required"
}

However, the request is exactly like this, and the token is properly set:

GET /web/app_dev.php/api/articles HTTP/1.1
Host    localhost.dev
Authorization   access_token=N2FmNzhhNGM2MTI5N2JhMWJlYjEdZjA0ZWM3ZTRhMTM1OGM0ODJjMzQzYjM7NTk3ZTEzNTVjZDczZTljMDk2MQ
Accept-Encoding gzip, deflate
Accept  application/json
Accept-Language en;q=1, fr;q=0.9, de;q=0.8, ja;q=0.7, nl;q=0.6, it;q=0.5
Connection  keep-alive
User-Agent  Localhost/1.0 (iPhone; iOS 6.1.4; Scale/2.00)

Is this not supported by FOSOAuthServerBundle?

Many thanks!!!

@alanbem
Copy link
Member

alanbem commented Sep 12, 2013

Authorization: Bearer N2FmNzhhNGM2MTI5N2JhMWJlYjEdZjA0ZWM3ZTRhMTM1OGM0ODJjMzQzYjM7NTk3ZTEzNTVjZDczZTljMDk2MQ

@Sydney-o9
Copy link
Author

You're a legend!
How do you know this? I mean, did I miss any documentation on this?

Many many thanks @alanbem! Works like a charm :)

@liuwenchao
Copy link

@Sydney-o9 here's the code if you find no documentation:

https://github.com/quizlet/oauth2-php/blob/00c255e80cf485604bb42f7d3432e4a622bbb94c/lib/OAuth2.php#L509

Your local version of this file may vary.

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

No branches or pull requests

3 participants