st4lk / django-rest-social-auth

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

how to access token with google-oauth2 login in #85

Open QAM opened 5 years ago

QAM commented 5 years ago

I tried to follow the link https://developers.google.com/identity/sign-in/android/offline-access to create authToken and send request to backend. The handler is SocialAuthViews.SocialTokenUserAuthView.as_view()

Google server return 400 with content. invalid_grant, bad request.

Could I know if you have any tutorial for google sign in? Thank you.

st4lk commented 5 years ago

Hi @QAM There is an example project in this package with google auth. Does it work for you?

QAM commented 5 years ago

Thank you @st4lk

I tried your example project .

Now, I can login google with android sdk.

But some finding. in your example project, your json input is clientId: "976099811367-ihbmg1pfnniln9qgfacleiu41bhl3fqn.apps.googleusercontent.com" code: "" redirectUri: "http://127.0.0.1:8000/" state: "kuycma6lgdo

I checked django_core src and found the "redirectUri" can't be eaten ... I need to change "redirectUri" to "redirect_uri" and then it can work.

So my solution is {"code":"", "provider":"google-oauth2", "redirect_uri": ""}

Hope it can work if anyone got this issue. Thank you for your help. Appreciate.