wagnerdelima / drf-social-oauth2

drf-social-oauth2 makes it easy to integrate Django social authentication with major OAuth2 providers, i.e., Facebook, Twitter, Google, etc.
https://drf-social-oauth2.readthedocs.io/en/latest/
MIT License
270 stars 34 forks source link

Authorization By `Bearer` not working #124

Closed krishnanpandya007 closed 2 years ago

krishnanpandya007 commented 2 years ago

As working on some protected backend views i have some views covered by permissions.IsAuthenticated which is only allow known users to hit this endpoint

As going to your quick manual image

i replaced <backend_name> with my custom backend name and <backend_token> by an access_token which is been generated by it-self but however when i try to hit protected endpoint i got error saying

{"detail":"Authentication credentials were not provided."}
wagnerdelima commented 2 years ago

Are you sure you have the correct token?

image

I am using postman and I can post successfully.

krishnanpandya007 commented 2 years ago

Are you sure you have the correct token?

image

I am using postman and I can post successfully.

I take access token from Django admin panel {Access Tokens} section and it's not expired yet

Am I doing or taking wrong token?

wagnerdelima commented 2 years ago

Let's go step by step. First you need to fire a request to the /convert-token endpoint. That will respond with a response that includes your access token. You're going to copy that token and include it to the Bearer . Are you doing that?

krishnanpandya007 commented 2 years ago

Let's go step by step. First you need to fire a request to the /convert-token endpoint. That will respond with a response that includes your access token. You're going to copy that token and include it to the Bearer . Are you doing that?

I am getting the access_token from localhost:8000/auth/token/ as i am getting this token from credentials details. I hope this also works. but still it's unAuthorized can u imagine any core cases (anything that affect)??

wagnerdelima commented 2 years ago

Do not get the token from auth/token, but from auth/convert-token.

krishnanpandya007 commented 2 years ago

Looks like configurations gone wrong at settings.py

Working now!!!

dimnik97 commented 1 year ago

Hi! I faced the same problem. Send request with the token I've got from auth/convert-token, but get the same error. What could be wrong?

image