alphapapa / ement.el

A Matrix client for GNU Emacs
GNU General Public License v3.0
488 stars 44 forks source link

Error when selecting "token" from authentication method choices after `ement-connect` #172

Closed philipsd6 closed 1 year ago

philipsd6 commented 1 year ago

When I execute ement-connect it prompts me for authentication and gives me four choices:

The only choice that works is password. All other choices result in an error like:

Ement: Checking server’s login flows...
error in process sentinel: Ement: Unsupported login flow:"token"  Server:"https://matrix-client.matrix.org"
Supported flows ("m.login.sso" "m.login.token" "m.login.password" "m.login.application_service") 
alphapapa commented 1 year ago

Hi Philip,

Thanks for reporting this. The code to allow choosing the login flow was recently added.

There is no direct support for the "token" method; it could be added, but it would seem nearly incorrect to do so, because that's not what's intended for Matrix clients to do. Each client is supposed to authenticate and receive its own token; users aren't intended to copy and paste a token from another client.

So probably what should be done here is to present only the "password" and "sso" flows; others should be omitted from the prompt.

What do you think? Do you really need to input a session token directly?

philipsd6 commented 1 year ago

Well, I leave that up to you. But me, I expect to go to most any service and get a token from the site that I can use locally. I had to go to element.io just to remember that my UserId is @philipsd6:matrix.org not just @philipsd. And if I go to Help & About there, I see that I can get an Access Token. So I figured I can use that, maybe it can provide longer lasting sessions or something (haven't looked into how the code is managing sessions, so not sure about that.)

But if it provides no benefit beyond userID and Passowrd, then it's fine as is. But even with ement-save-sessions set, I generally have to re-login every time I restart my VM or my emacs. I would generally prefer to have ement connect automatically when I start up, without prompting me. Unless absolutely necessary.

alphapapa commented 1 year ago

Well, I leave that up to you. But me, I expect to go to most any service and get a token from the site that I can use locally. I had to go to element.io just to remember that my UserId is @philipsd6:matrix.org not just @philipsd. And if I go to Help & About there, I see that I can get an Access Token. So I figured I can use that, maybe it can provide longer lasting sessions or something (haven't looked into how the code is managing sessions, so not sure about that.)

There's nothing to stop you from manually copying a session token from another session, but that's not how Matrix is intended to work. Each client on each device is intended to authenticate and receive its own session token; a session lasts until it is canceled, which you can do from the Element app (or any client that provides a UI for it; Ement doesn't yet).

But if it provides no benefit beyond userID and Passowrd, then it's fine as is. But even with ement-save-sessions set, I generally have to re-login every time I restart my VM or my emacs. I would generally prefer to have ement connect automatically when I start up, without prompting me. Unless absolutely necessary.

If session saving is not working for you, that would be a different problem than the one described here about selecting the "token" login flow. Session saving works for me and other users, so something must be going wrong somewhere.

philipsd6 commented 1 year ago

OK, I'll pay more attention to when my session saving isn't working correctly and open up an new issue if I can isolate it. In that light, I'll close this issue. But for UI clarity, it might be better to not provide the full list of authentication methods that it currently does, since they all (IIRC) result in an error, except for "password".

alphapapa commented 1 year ago

OK, I'll pay more attention to when my session saving isn't working correctly and open up an new issue if I can isolate it.

Thanks.

In that light, I'll close this issue. But for UI clarity, it might be better to not provide the full list of authentication methods that it currently does, since they all (IIRC) result in an error, except for "password".

Yes, so I'll reopen this issue to track that.