st4lk / django-rest-social-auth

OAuth signin with django rest framework
MIT License
521 stars 122 forks source link

redirect_uri is not clear in the docs #86

Closed basilbegonia closed 5 years ago

basilbegonia commented 5 years ago

I'm not sure if I'm reading the docs incorrectly, but I am running into issues while trying to set the redirect URI for JWT authentication with Google and Facebook.

For Google, I created the client id and application for oauth as follows:

image

I set the secret and key in settings.py

I visited https://accounts.google.com/o/oauth2/v2/auth?client_id=<client_id>&response_type=code&scope=email&redirect_uri=http://localhost:3000/login and got the code from the redirect. After that, I sent it to the local backend http://localhost:8000/login/social/jwt-pair/ with body

{
'provider': 'google-oauth2',
'code':'<>
}

but I get this error message :

Authentication process canceled; ; {'error': 'invalid_grant', 'error_description': 'Bad Request'}
[02/Apr/2019 08:00:56] "POST /login/social/jwt-pair/ HTTP/1.1" 400 0

Same goes for Facebook. Is this a bug, missing in the docs, or my error?

Thanks