Closed ifinkelstein closed 8 months ago
There were issues recently with stolen authentication token cookies/context, maybe related.
It may also be that with latest JDK DavMail is unable to register custom protocol handler, look for "Unable to register protocol handler" message in davmail.log.
You can try to change Info.plist JVMOptions to:
<key>JVMOptions</key>
<array>
<string>-Dsun.net.inetaddr.ttl=60 -Xmx512m --add-exports java.base/sun.net.www.protocol.https=ALL-UNNAMED</string>
</array>
Did you also try the manual authentication mode ?
Thank you so much for getting back to me. I did notice the following WARN-level event:
Date: Fri Jan 05 14:04:02 CST 2024 (1704485042586)
Thread: AWT-EventQueue-0
Message #: 7
Level: WARN
NDC:
Category: davmail.exchange.auth.O365InteractiveAuthenticatorFrame
Message: Unable to register protocol handler
Location: davmail.exchange.auth.O365InteractiveAuthenticatorFrame.<clinit>(O365InteractiveAuthenticatorFrame.java:158)
Thrown:
I added the following to the Info.plist file, but alas the protocol handler warning still crops up and I get stuck with the same failure to authenticate:
<array>
<string>-Dsun.net.inetaddr.ttl=60 -Xmx512m --add-exports java.base/sun.net.www.protocol.https=ALL-UNNAMED</string>
</array>
I also tried the following Java installations, all via sdkman
, with the same WARN in the log file.
8.0.392.fx-zulu
On a related note, I noticed that DavMail 6.2.1 (latest build) doesn't generate the WARNING, but also doesn't pop up any authentication window. I can get the window (and the unable to register custom protocol handler
warning) in DavMail 6.1.0 and 6.2.0
Please advise on what I can try next and thank you for your time!
O365Manual
tests:
I can copy the URL to either Safari or Chrome and authenticate via my SSO + Duo. Then, I'm asked:
Are you trying to sign in to Microsoft Office?
The URL is: https://login.microsoftonline.com/login.srf
Clicking Continue just keeps taking me to the same page. I never see a blank page.
Should I examine the source and attempt to extract a cookie or URI? Not familiar what I should do at this stage.
For O365Interactive, have you tried adding --add-exports java.base/sun.net.www.protocol.https=ALL-UNNAMED
to your JVMOptions in the DavMail Info.plist, @ifinkelstein ?
Yup, see above:
I added the following to the Info.plist file, but alas the protocol handler warning still crops up and I get stuck with the same failure to authenticate:
<array> <string>-Dsun.net.inetaddr.ttl=60 -Xmx512m --add-exports java.base/sun.net.www.protocol.https=ALL-UNNAMED</string> </array>
Yup, see above:
Oh, sorry. It was scrolled off to the right, and I didn't see it.
No worries @esabol . I am really grateful for your help, and for @mguessan and his amazing DavMail.
Hoping against hope that I can again be free from the suffocating O365 soon.
Based on other reports, it does seem as though O365Manual does not work with Duo. This is because the authentication URL that Duo uses is different, and DavMail can't parse the token it needs from what Duo responds with. Or something like that.
So your only hope (unless you want to develop a patch to DavMail to improve O365Manual to work with Duo – which I'm not sure is even possible), I suspect, is O365Interactive. The problem there is that you're on a Mac (right?) and Java on recent macOS releases doesn't come with the JFX library to open the authentication window in DavMail. You've installed some version of JFX using "sdkman", but getting the Mac version of DavMail to use it is the real challenge, I suspect.
Adding the zulu JFX library via an appropriate -classpath
argument to the JVMOptions in the Info.plist might be your best bet and worth a try.
Also, if you look inside the DavMail.app bundle on the Mac, you might be able to find the davmail.jar and run that directly from the command line in Terminal with the appropriate arguments.
Just some ideas...
Oh, maybe try copying the zulu JFX jar file(s) to the same directory that the davmail.jar is located inside the DavMail.app bundle?
Copying just the OpenJFX libs to DavMail.app will not work, you need to have full jre with fx embedded in app.
Anyway you need to go a bit further on manual mode, a.k.a authenticate in native browser. It's normal that you never get the empty page when using the urn: redirectUri, as this url is not supported by the browser.
You need to check console and / or network tab in dev tools, on last authentication step you should be able to retrieve the url with the right code.
@ifinkelstein : Where did sdkman install the zulu JFX library?
Try adding -Djava.library.path=/path/to/zulu-jx --module-path /path/to/zulu-jfx --add-modules javafx.base,javafx.controls,javafx.web,javafx.fxml,javafx.swing
to the JVMOptions, replacing /path/to/zulu-jfx
with the correct path, of course. I think that needs to come after the --add-exports java.base/sun.net.www.protocol.https=ALL-UNNAMED
.
Thank you for all the suggestions. Will troubleshoot some more and reply in a few days.
I'm having exactly the same issue. I noticed that the evolution mail client gets around it by using an OAB url, they talk about it here. This worked fine when using that mail client. So just writing it here hoping that whatever they did, you can also copy it over for davmail.
Had some more time to debug my config.
https://github.com/mguessan/davmail/issues/332#issuecomment-1941348657 was sufficient to authenticate with O365Manual; I'm in business again (I think)
I use O365Interactive authentication with DavMail 6.2.0 (issue persists in 6.2.1).
I have not changed my working .davmail.properties in some months.
I also have to use the following settings to login to my network:
After my University SSO and Duo 2FA authentication, I get a screen with
Are you trying to sign in to Microsoft Office?
After clickingContinue
, I get a new page with the following error message:DavMail eventually times out (nothing too interesting in the log file)
Is there a change to the Outlook clientID? Happy to help troubleshoot, if possible.
Updates: