A
A
Alexander Bondarenko2021-09-06 17:14:20
Google
Alexander Bondarenko, 2021-09-06 17:14:20

How to get Google token for Django OAuth2?

Hello everyone, I'm trying to implement registration through the Django REST Framework Social OAuth2, I did everything as in the documentation , but when I try to get an access_token, I get errors either {"error":"access_denied","error_description":"Your credentials aren't allowed" }, if I manually specify the client_id and secret, but I don't have the google_token itself, tell me how to get it correctly and where?
Here is the request itself for getting the token from the documentation:

curl -X POST -d "grant_type=convert_token&client_id=<django-oauth-generated-client_id>&client_secret=<django-oauth-generated-client_secret>&backend=google-oauth2&token=<google_token>" http://localhost:8000/auth/convert-token

I will be grateful for help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-09-06
@karabanov

So at the end it says:

You can get the ID (SOCIAL_AUTH_GOOGLE_OAUTH2_KEY) and secret (SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET) of your app at https://console.developers.google.com/apis/credentials and more information on how to create one on https://developers.google.com /identity/protocols/OAuth2 .
For testing purposes, you can use the access token from https://developers.google.com/oauthplayground/ .
For more information on how to configure python-social-auth with Google visit https://python-social-auth.readthedocs.io/en/lates... .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question