google / gmail-oauth2-tools

Tools and sample code for authenticating to Gmail with OAuth2
Apache License 2.0
404 stars 211 forks source link

401 errors #28

Open mathstuf opened 3 years ago

mathstuf commented 3 years ago

Does this not work for non-GSuite accounts? I made the app and client ID. However, when I go through and get a token, all I ever get is a 401. There's no error message in the body of the response.

Has something changed that needs updated in the script?

junyer commented 11 months ago

In https://github.com/google/gmail-oauth2-tools/issues/53#issuecomment-1648365410, I noted that the wiki page hasn't been updated for six years, so it could be that the instructions there are lacking – or just plain wrong – even for "normal" accounts. As of commit 944cffd66df38863eb0252a8096961335e418e70, oauth2.py does actually work though...

jesseclark commented 2 weeks ago

Following these instructions from the gmail-ouath2-tools library worked for me:

NOTE: The OAuth2 OOB flow isn't a thing anymore. You will need to set the application type to "Web application" and then add https://oauth2.dance/ as an authorised redirect URI. This is necessary for seeing the authorisation code on a page in your browser.