mustang-im / mustang

Mustang - New full-featured desktop email, chat and video conference client
https://mustang.im
Other
9 stars 2 forks source link

OWA: Fill out standard login forms #160

Open benbucksch opened 3 months ago

benbucksch commented 3 months ago

In Owl, we are able to automatically fill out the standard OWA login forms of the on-premise Exchange servers, if they have not been altered/redirected.

NeilRashbrook commented 3 months ago
  • If at all possible, please even use the OAuth2UI API to open the OWA login dialog.

We're actually still opening the OAuth2UI dialog in the default session. As far as I know, we'd have to move some of the code into backend.ts to be able to open it in a custom session. At that point it might be possible to share some code with OWA.

benbucksch commented 3 months ago

The fill out code should be agnostic about the type of window and should work both in OAuth2Window and OAuth2Dialog. (Obviously, it won't work in OAuth2Browser). The events for URL change and page loaded with DOM should be forwarded to the logic code in the renderer process.

I'll see myself whether I can wing that. You can concentrate on Calendar and then ActiveSync for now.

25.07.2024 18:17:10 Neil Rashbrook @.***>:

  • If at all possible, please even use the OAuth2UI API to open the OWA login dialog.

We're actually still opening the OAuth2UI dialog in the default session. As far as I know, we'd have to move some of the code into backend.ts to be able to open it in a custom session. At that point it might be possible to share some code with OWA.

— Reply to this email directly, view it on GitHub[https://github.com/mustang-im/mustang/issues/160#issuecomment-2250862826], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAORWRLSTMJCU632JQQBFFLZOEQH3AVCNFSM6AAAAABLNR5SYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJQHA3DEOBSGY]. You are receiving this because you authored the thread. [Verfolgungsbild][https://github.com/notifications/beacon/AAORWRKE3ATLFIZNSIKUDDTZOEQH3A5CNFSM6AAAAABLNR5SYCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUGFFYOU.gif]

NeilRashbrook commented 3 months ago

You confused me when you said standard OWA login forms; I thought you meant the way that Owl can log in to those forms directly without having to open them in a tab or window. Well, I've written some code for that now. The problem I ran into is that session.fetch doesn't return the url (this is actually documented, but I hadn't previously noticed the "Limitations" section), so I had to write my own fetch polyfill using net.request (which is a Node-style interface). Anyway, I've pushed my work to branch neil/owa-login-in-background if you're interested.

NeilRashbrook commented 3 months ago

Filling in the login window from the backend turned out to be quite simple, so I've pushed that to branch neil/owa-fill-login-window if you're interested. This is basically Owl's Office 365 script, which doesn't seem to work on, say, Exchange 2019 (but there the other branch does of course work), although I removed the password error message notification because I don't know how that would work in mustang (and it would be a bit of a hack in electron). I would put the autoFillLoginPage function somewhere shared but I have no idea where that would be.

benbucksch commented 3 months ago

I removed the password error message notification because I don't know how that would work in mustang

This is during interactive login, right?

Could you put in the code that catches this situation, and add a code comment where we'd handle it? I can then think about a mechanism and way to react to it.

If this "password wrong" error happens during background login without window, then we need to throw a LoginError with appropriate error message and the original exception. This should then automatically populate to the UI.