django-gmailapi-backend icon indicating copy to clipboard operation
django-gmailapi-backend copied to clipboard

Error 400: redirect_uri_mismatch

Open yojimboth opened this issue 3 years ago • 1 comments

When I try to generate the GMAIL_API_REFRESH_TOKEN using the command provided with the valid client_Id and client_secret information, the "gmail_auth2" script gave me a URL but when I copied and paste it to the Browser, google displayed the "Authorization" error with "ERROR 400: redirect_uri_mismatch" and the body detail is below:

The redirect URI in the request, urn:ietf:wg:oauth:2.0:oob, can only be used by a Client ID for native application. It is not allowed for the WEB client type. You can create a Client ID for native application at https://console.developers.google.com/apis/credentials/oauth...

Please help to look into the issue.

Regards, YoJimBo

yojimboth avatar Mar 17 '21 09:03 yojimboth

Hello, it is a while from my last setup, so I repeated from scratch for testing.

  1. I used a personal Google account
  2. Create a project in https://console.cloud.google.com/
  3. Enable Gmail API from the API library
  4. Then you should setup the Oauth consent screen. Google will guide you in the setup. For testing, you will have to add the test users explicitly
  5. Create new OAuth credentials
  6. Select type Desktop App (this might be what is not working for you)

Let me know if this is working. In case we will update the README with more details.

dolfim avatar Mar 17 '21 20:03 dolfim