Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imap authentication not working #78

Open
ajendrex opened this issue Aug 1, 2024 · 0 comments
Open

imap authentication not working #78

ajendrex opened this issue Aug 1, 2024 · 0 comments

Comments

@ajendrex
Copy link

ajendrex commented Aug 1, 2024

Hi!

I have an access token with scope https://www.googleapis.com/auth/gmail.modify and which I validated with SMTP to send emails. The same token used to try oauth2.py from this repository seems to be invalid:

python oauth2.py --test_imap_authentication --access_token=<access_token> --user=<email_address>

  18:48.35 > b'ILPK1 AUTHENTICATE XOAUTH2'
  18:48.50 < b'+ '
  18:48.50 write literal size 364
  18:49.49 < b'+ eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ=='
  18:49.49 write literal size 364
  18:49.64 < b'ILPK1 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)'
Traceback (most recent call last):
  File "/Users/hurbina/src/gmail-oauth2-tools/python/oauth2.py", line 353, in <module>
    main(sys.argv)
  File "/Users/hurbina/src/gmail-oauth2-tools/python/oauth2.py", line 338, in main
    TestImapAuthentication(
  File "/Users/hurbina/src/gmail-oauth2-tools/python/oauth2.py", line 282, in TestImapAuthentication
    imap_conn.authenticate('XOAUTH2', lambda x: auth_string)
  File "/Users/hurbina/opt/anaconda3/lib/python3.9/imaplib.py", line 444, in authenticate
    raise self.error(dat[-1].decode('utf-8', 'replace'))
imaplib.IMAP4.error: [AUTHENTICATIONFAILED] Invalid credentials (Failure)

I'd appreciate very much some help to understand what is wrong.

Hector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant