himalaya icon indicating copy to clipboard operation
himalaya copied to clipboard

Outlook oauth - cannot wait for redirection error

Open Krowemoh opened this issue 1 year ago • 3 comments

I could be doing something wrong (hopefully). I'm getting a page that displays a successful auth:

Authentication successful!

But then in himalaya, I get the following error

Error:
   0: cannot wait for oauth2 redirection error
   1: cannot exchange code for access and refresh tokens: error while sending request

I have a configuration already set up with my keyring set up. To try and get the auth done, I'm running:

himalaya account doctor --fix --trace

The configuration:

[accounts.outlook]
default = true
email = "[email protected]"
display-name = "username"
downloads-dir = "/home/usr/username/Downloads"

backend.type = "imap"
backend.encryption.type = "tls"
backend.host = "outlook.office365.com"
backend.port = 993
backend.login = "[email protected]"
backend.auth.type = "oauth2"
backend.auth.method = "xoauth2"
backend.auth.client-id = "CLIENT-ID"
backend.auth.client-secret.keyring = "outlook-oauth2-client-secret"
backend.auth.access-token.keyring = "outlook-oauth2-access-token"
backend.auth.refresh-token.keyring = "outlook-oauth2-refresh-token"
backend.auth.auth-url = "https://login.microsoftonline.com/TENANT-ID/oauth2/authorize"
backend.auth.token-url = "https://login.microsoftonline.com/TENANT-ID/oauth2/token"
backend.auth.pkce = true
backend.auth.scopes = ["https://graph.microsoft.com/IMAP.AccessAsUser.All","https://graph.microsoft.com/SMTP.Send"]
backend.auth.redirect-scheme = "http"
backend.auth.redirect-host = "localhost"
backend.auth.redirect-port = 8203

message.send.backend.type = "smtp"
message.send.backend.host = "smtp.mail.outlook.com"
message.send.backend.port = 587
message.send.backend.starttls = true
message.send.backend.login = "[email protected]"
message.send.backend.auth.type = "oauth2"
message.send.backend.auth.method = "xoauth2"
message.send.backend.auth.client-id = "CLIENT-ID"
message.send.backend.auth.client-secret.keyring = "outlook-oauth2-client-secret"
message.send.backend.auth.access-token.keyring = "outlook-oauth2-access-token"
message.send.backend.auth.refresh-token.keyring = "outlook-oauth2-refresh-token"
message.send.backend.auth.auth-url = "https://login.microsoftonline.com/TENANT-ID/oauth2/authorize"
message.send.backend.auth.token-url = "https://login.microsoftonline.com/TENANT-ID/oauth2/token"
message.send.backend.auth.pkce = true
message.send.backend.auth.scopes = ["https://graph.microsoft.com/IMAP.AccessAsUser.All","https://graph.microsoft.com/SMTP.Send"]

As an aside, has the himalaya configure -a outlook been deprecated? I stumbled into the doctor command which seems to be doing what I want but not sure.

Krowemoh avatar Mar 18 '25 04:03 Krowemoh

I plan to refactor the OAuth lib, so I will investigate as soon as I dive into the topic. Thank you!

soywod avatar Mar 24 '25 10:03 soywod

Same here

boonkerz avatar Aug 25 '25 09:08 boonkerz

Same here

cboecking avatar Sep 24 '25 18:09 cboecking