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

access_token in header (Authorization Bearer OGQwMzQ2MD...) #280

Closed
marcelglaeser opened this issue Nov 3, 2014 · 4 comments
Closed

access_token in header (Authorization Bearer OGQwMzQ2MD...) #280

marcelglaeser opened this issue Nov 3, 2014 · 4 comments

Comments

@marcelglaeser
Copy link

Hi at all,
i create a api with help of your bundles and all things worked fine.
But if i try to send the access_token via header i get always a 401 "access_denied". If i send the access_token via url (api/user/self?access_token=....) all worked fine. What's the problem?

I read all site like this one https://groups.google.com/forum/#!topic/symfony2/28LvLvZPpx0, but nothing worked for me.

The log file say: security.INFO: Authentication exception occurred; redirecting to authentication entry point (A Token was not found in the SecurityContext.) [] []
But why??

Thanks for your help,
Marcel

@Spomky
Copy link

Spomky commented Nov 3, 2014

Can you show us your request? We can not help you without more informations.
Did you seen #185?

@marcelglaeser
Copy link
Author

I found a solution:
This must in the .htaccess

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.)
RewriteRule .
- [e=HTTP_AUTHORIZATION:%1]

And i write "authorization", not "Authorization". Now all things worked for me.

Before i do this, the Request Header in the profiler show always "Basic Ym9zY236Ym9zY28=", not i can find "Bearer YTg5NT......"

My request was:"https://*_.de/app_dev.php/api/user/self" and in the header was "Authorization:" "Bearer YTg5NTNhNDQ3Z_". But in the symphony profile was only "Basic Ym9zY236Ym9zY28=". Was this your question?

sry for my english :(

@alanbem
Copy link
Member

alanbem commented Nov 3, 2014

so, this issue can be closed?

@marcelglaeser
Copy link
Author

Yes! Maybe it will help someone.

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