Support OAuthBearer
idcooldi opened this issue · comments
Nix commented
options := &imapclient.Options{
WordDecoder: &mime.WordDecoder{CharsetReader: message.CharsetReader},
DebugWriter: os.Stdout,
}
c, err := imapclient.DialTLS(fmt.Sprintf("%s:%d", imapServer, imapPort), options)
if err != nil {
log.Fatal(err)
}
defer c.Close()
cl := sasl.NewOAuthBearerClient(&sasl.OAuthBearerOptions{
Username: username,
Token: token,
Host: imapServer,
Port: imapPort,
})
err = c.Authenticate(cl)
if err != nil {
log.Fatal(err)
}
Result :
* OK Yandex IMAP4rev1 at mail-imap-production-29.iva.yp-c.yandex.net:993 ready to talk with ::ffff:46.73.73.218:64853, 2023-Aug-14 12:55:20, KtaXGO0WxOs0
T1 CAPABILITY
* CAPABILITY IMAP4rev1 CHILDREN UNSELECT LITERAL+ NAMESPACE XLIST BINARY UIDPLUS ENABLE ID AUTH=PLAIN AUTH=XOAUTH2 IDLE MOVE
T1 OK CAPABILITY Completed.
T2 AUTHENTICATE OAUTHBEARER
T2 BAD AUTHENTICATE Command syntax error. sc=KtaXGO0WxOs0_140955_imap-production-29
2023/08/14 12:55:20 imap: BAD AUTHENTICATE Command syntax error. sc=KtaXGO0WxOs0_140955_imap-production-29
Please help me with OAuthBearer token
Simon Ser commented
This server doesn't support the OAUTHBEARER
mechanism (see the AUTH=
fields in the CAPABILITY
response).
Nix commented
This server doesn't support the
OAUTHBEARER
mechanism (see theAUTH=
fields in theCAPABILITY
response).
Yandex confirmed that for mail services, authorization is based only on application passwords.