dolfim / django-gmailapi-backend

Email backend for Django which sends email via the Gmail API
Apache License 2.0
31 stars 9 forks source link

Error 400: redirect_uri_mismatch #3

Open yojimboth opened 3 years ago

yojimboth commented 3 years ago

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

dolfim commented 3 years ago

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.