Comments (12)
Makes sense, please check latest trunk for a command line implementation of manual authentication.
Please also set davmail.mode to O365Manual, no need to try OpenJFX browser in your case.
You should probably also try to enable token persistence with:
davmail.oauth.persistToken=true
This will drastically reduce user interaction.
from davmail.
Can we make interactive mode work on the CLI? Basically, what works for me in UI mode is the popup window that uses xdg-open to start the browser and then allows me to insert the resulting token into the window input line and finally clicking OK.
What I did is to replace xdg-open with a shell script that copies the link into a file, I open that link with my browser outside of the container and then paste the resulting token back into the DavMail UI window.
For me it would be nice if DavMail would support that "interactive" workflow in headless mode. E.g.
- print the link on stdout
- prompt the user for the token on stdin
- CLI paste / return
This way, I could run in headless mode again (running the container attached to a tty inside of tmux) and do the UI auth bits outside of the container without the need to do fancy X11 forwarding and library installation to support the UI.
from davmail.
This may be a device authentication issue => after authentication O365 checks that client has a valid certificate. As your Docker container obviously is not registered this will not work.
Anyway, you should first find the right settings with DavMail in client mode, with O365Interactive or O365Manual.
from davmail.
Thanks @mguessan
Where do I find more information about the O365Manual mode? Does this work in "headless" mode too?
How do I make sure that davmail has a valid client certificate? I see how I can store it, but how do I create it? (http://davmail.sourceforge.net/sslsetup.html)
from davmail.
Nope, O365Manual and O365Interactive open authentication dialogs and will thus not work in headless mode.
However this can help you find the right settings
from davmail.
Please make sure you test in standalone mode before trying server/docker/headless mode.
You may have to use another clientId, see:
https://sourceforge.net/p/davmail/bugs/702/
Once you have it working in standalone mode, we can troubleshoot headless mode.
from davmail.
small correction... apparently, DavMail switches to manual mode when the proper libraries aren't installed. So in my case, I could see this:
2019-10-07 09:15:08,214 WARN [AWT-EventQueue-0] davmail.exchange.auth.O365InteractiveAuthenticator - Unable to load JavaFX (OpenJFX), switch to manual mode
which resulted in the "input OAUTH token" window / dialog which is perfectly fine for my workflow even though it requires the extraction of the Location header from the final POST response.
from davmail.
Tried with latest trunk. However, the code in ExchanceSessionFactory.java
checks if we run in headless mode and then throws an exception if auth mode is set to O365Manual or O365Interactive. At least for O365Manual, that restriction needs to be removed.
from davmail.
Indeed, can you please test again ?
from davmail.
thanks... one step further but no success yet.
2019-10-09 22:10:44,912 ERROR [ImapConnection-49858] davmail - Authentication failed null
davmail.exception.DavMailException: Authentication failed null
at davmail.exchange.auth.O365ManualAuthenticator.authenticate(O365ManualAuthenticator.java:137)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:177)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:93)
at davmail.imap.ImapConnection.run(ImapConnection.java:139)
Please open the following link:
https://login.microsoftonline.com/common/oauth2/authorize?client_id=...
proceed through authentication steps and paste back the final url that contains authentication code (blank page)
Authentication code: 2019-10-09 22:10:44,915 ERROR [ImapConnection-49858] davmail.exchange.auth.O365ManualAuthenticator - Authentication failed, code not available
2019-10-09 22:10:44,915 ERROR [ImapConnection-49858] davmail - Authentication failed null
davmail.exception.DavMailException: Authentication failed null
at davmail.exchange.auth.O365ManualAuthenticator.authenticate(O365ManualAuthenticator.java:137)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:177)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:93)
at davmail.imap.ImapConnection.run(ImapConnection.java:112)
I paste the link into the console and hit return. The string contains the code and session_state query parms. It basically is this (which worked with the dialog when pasted there, so I assume it's the right thing):
urn:ietf:wg:oauth:2.0:oob?code=somelongalphanumstring&session_state=some-uuid
I guess a bit more logging inside the getCodeFromConsole
method would be useful to figure out whether it actually read the string and extracted the code. Maybe even print the extracted code again at debug level or something. Thanks again!
from davmail.
OK. My fault. I did add the instrumentation code and build it from trunk myself to realize that I of course need a tty in the container... otherwise the readLine() will instantly return as stdin is eof. Looking good. Works for me :) Thanks!
from davmail.
Great, thanks for your feedback => closing issue.
from davmail.
Related Issues (20)
- Error retrieving calendar events with Outlook/Thunderbird HOT 4
- Tag 6.2.1 release on GitHub HOT 1
- Cannot connect with O365Manual (or any other setting) HOT 10
- Using Davmail to reveal mail settings? HOT 2
- Outlook client ID HOT 8
- Davmail not authenticating request to exchange HOT 2
- Apparently Oracle doesn't understand retirement. HOT 5
- Need to store mutable oath refresh token somewhere other than davmail.properties HOT 2
- davmail.exchange.ews.EWSException: ErrorCorruptData exception when trying to send invitation answer HOT 2
- Can't delete a single occurrence of a recurring event HOT 1
- Bootstrapping oauth2 token HOT 5
- Javax.mail casting errors HOT 1
- Not able to delete an event in a series with outlook.com and Thunderbird HOT 9
- Could you please add support for Office 365 China version HOT 1
- Events automatically change timezone and are consequently displayed with the wrong time HOT 10
- IMAP Select unexpected response HOT 2
- O365Interactive fails with "superclass access check failed: class davmail.exchange.auth.O365InteractiveAuthenticatorFrame" HOT 3
- O365Interactive & O365Manual: "The provided resource value for the input parameter 'scope' is not valid." HOT 1
- davmail build on linux: Cannot run program "dist/jdk/bin/jlink.exe" HOT 1
- Events copied and pasted from another calendar displayed with wrong time
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from davmail.