Google oauth2 no longer provides access token but the idToken
MehdiDRISSIB opened this issue · 10 comments
Hello @wagnerdelima
google provide only id_token and no longer accesstoken which is expected in your library
I'm using the api convert-token for google login. Google provide now only the id_token as it's explained here: https://developers.google.com/identity/sign-in/web/backend-auth?hl=en
the api convert-token throws error: "Your credentials aren't allowed" because of this. All my credentials are correct except this one. Please fix the issue.
Many thanks in advance
yeah am also facing same issue
@MehdiDRISSIB Have you any solution or work around?
Here is a proposed solution but I didn't test it yet. If you do, please give a feedback and the whole code. I'm still waiting for a fix on this library
@MehdiDRISSIB how can I get the id token from google playground (https://developers.google.com/oauthplayground/)? It still gives me the access token. So it's hard to implement the feature. Thanks.
@wagnerdelima You can obtain the id_token
in Google Identity Service which is the recommended way for new APIs.
@SukiCZ and @MehdiDRISSIB this answer works. However, there is a little configuring you need to do.
First of all, add the code from the link in this file drf_social_oauth2/backends.py, like so:
The in your settings, replace the green by the blue one. This is the new class you just created.
In your request, replace google-oauth2 backend by google-identity.
Send the request and success!
I can't make a fix right now because I have to further my studies on this. Soon I will provide a solution with a release tag.
@wagnerdelima I believe this issue is more related to social-core
and new "Google Identity Service Backend" should be provided there. It has a lot in common with previous Google Plus Backend.
This is related - python-social-auth/social-core#710
@SukiCZ yes I understand. But we don't need to submit a correction to social core, we can make it here.
Hello
I just tried the solution of @wagnerdelima and it works very well. Many thanks !
We are waiting for the solution in the new release
Hi @SukiCZ , @MehdiDRISSIB, @Hexvortex and @vbabiy,
I just publish a new release with the fixes. Thanks for contributing!