Issues with XOAUTH2
See original GitHub issueI am trying to use XOAUTH2 to connect to google IMAP, I updated the Connections constructor method by allowing set config.xoauth2.
Could you help check why this happened, and how to fix it?
<= '* OK Gimap ready for requests from 50.156.50.203 qk7if1705226pac.117'
=> 'A0 CAPABILITY'
<= '* CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2'
<= 'A0 OK Thats all she wrote! qk7if1705226pac.117'
=> 'A1 AUTHENTICATE XOAUTH2 xxxx'
<= '+ eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ=='
<= 'A1 NO Invalid SASL argument. qk7if1705226pac.117'
{ [Error: {"status":"400","schemes":"Bearer","scope":"https://mail.google.com/"}] textCode: undefined, source: 'authentication' }
My imap options:
{ host: 'imap.gmail.com',
port: 993,
tls: true,
user: 'xxxxxxxxxxx@gmail.com',
password: '',
xoauth2: 'xxxx',
tlsOptions: { rejectUnauthorized: false },
debug: console.log
}
Issue Analytics
- State:
- Created 10 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
SMTP XOAUTH2 Authentication Problem for GoDaddy accounts
SMTP XOAUTH2 Authentication Problem for GoDaddy accounts. Dear Sir/Madam,. We are following Microsoft authentication instructions to connect ...
Read more >OAuth 2.0 Mechanism | Gmail - Google Developers
This document defines the SASL XOAUTH2 mechanism for use with the IMAP AUTHENTICATE , POP AUTH , and SMTP AUTH commands. This mechanism...
Read more >PHPMailer authentication issue xoauth2 - Stack Overflow
Auth method requested: XOAUTH2 Auth methods available on the server: PLAIN,LOGIN SMTP Error: Could not authenticate. Now my host isn't ...
Read more >MS Exchange - IMAP-XOAuth2 authentication fails - GitLab
The OAuth2 client obtains a valid token with proper scopes - but it doesn't speak IMAP-XOAuth2 correctly. The problem is in the OAuth2...
Read more >oauth2 - Go Packages
oauth2 package contains a client implementation for OAuth 2.0 spec. Installation. go get golang.org/x/oauth2.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Make sure your xoauth2 string is formatted like this
new Imap({xoauth2:btoa("user="+USER+"\x01auth=Bearer "+TOKEN+"\x01\x01"), ... })
Thanks for the prompt reply! I figured out that the issue was with my scopes when authorizing with OAuth2. I needed to add “https://mail.google.com/” to my list of scopes