social-app-django icon indicating copy to clipboard operation
social-app-django copied to clipboard

Unauthorized for url: https://www.googleapis.com/oauth2/v3/userinfo

Open zned45 opened this issue 4 years ago • 1 comments

Working in a mobile app that send the Google Token to the server. On the sever I try to verify the token with no sucess. I use the following view. I have already tried many sets of credentials including the ones setup for the Android app.

SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = ['email', 'profile']

@api_view(http_method_names=['POST'])
@permission_classes([AllowAny])
@psa()
def exchange_token(request, backend):
    access_token = request.data.get('token')
    user = request.backend.do_auth(access_token)
    return {'meta': 'ok'}

I get the following error:

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://www.googleapis.com/oauth2/v3/userinfo

Can anyone help? Thanks

zned45 avatar Feb 22 '21 15:02 zned45

We had the same problem and the solution was a correct review about the token, because you cant use manager account tokens if you are run in localhost, and the same in the otherway. Good luck

juanml30 avatar Feb 07 '22 18:02 juanml30