dylex / slack-libpurple

Slack module for libpurple
GNU General Public License v2.0
276 stars 38 forks source link

Login error: unknown_method #173

Closed dshanske closed 1 year ago

dshanske commented 1 year ago

Updated my plugin to the latest version and started getting a Login error: unknown method error.

waptaff commented 1 year ago

I run a version that dates back August 2021 and I also get this unknown_method; that started to happen to me on 2022 Dec 15 21:53 UTC.

Likely related to https://github.com/dylex/slack-libpurple/issues/137#issuecomment-1353696095

waptaff commented 1 year ago

This seems to happen with password authentication only.

If in the password field, a legacy token is used, login works, as using a token skips over the now-gone auth.findUser API call.

Those tokens are long strings that start with xox that can be found at https://api.slack.com/legacy/custom-integrations/legacy-tokens but AFAIK unfortunately new ones cannot be created.

As auth.findUser is only used to resolve an e-mail address into an internal Slack User ID, perhaps it'd be possible to add a configuration field that stores this along with the username; I don't know if it's doable though, I'm not familiar with PurpleAPI internals.

dylex commented 1 year ago

This is unfortunate. It would be a fairly easy change to skip auth.findUser and use the username as the userid, but (1) it's not trivial to get a userid out of slack, and (2) I'm worried if they got rid of this they may have changed the whole authentication flow, so auth.signin may not work either. Unfortunately none of my slacks seem to be giving this error (yet), so I don't have a good way of testing this. If someone else would like to, I've put a hack on the finduserhack branch that uses email as userid if it doesn't have a @ (which userids should not).

I believe this authentication flow was originally extracted from the mobile client. We could try to figure out what it does now...

Thaodan commented 1 year ago

Started to get these a few days earlier too. I tried to find docs around the api call however no other program does use it from what I see.

Thaodan commented 1 year ago

I believe this authentication flow was originally extracted from the mobile client. We could try to figure out what it does now...

https://github.com/dylex/slack-libpurple/pull/162 might help here, it's not as good of a workflow but is a good intermediate thing until we have something else.

dchmelik commented 1 year ago

I have same problem on this year's slack-libpurple versions.

Fyren commented 1 year ago

Unfortunately none of my slacks seem to be giving this error (yet), so I don't have a good way of testing this. If someone else would like to, I've put a hack on the finduserhack branch that uses email as userid if it doesn't have a @ (which userids should not).

I tried out the branch and it appears to work for me.

xsteadfastx commented 1 year ago

does the branch only work if i have a legacy token? or does the normal password authentication work?

Fyren commented 1 year ago

I only tried it with a password.

kacf commented 1 year ago

I think the login method doesn't matter, because with that branch you do the login in your browser, and only the tokens are given to libpurple.

Fyren commented 1 year ago

I am using the branch with my actual password.

kacf commented 1 year ago

Ok. My point is that even with a password, you can use the token approach which is described in the pull request, and that method would also work.

xsteadfastx commented 1 year ago

ok... right now i just used the branch... didnt reauthenticate or something. still get the unknown method error. so i should delete the account and try to readd it?

kacf commented 1 year ago

You have to use the approach described at the top of #162, you can't just input your password.

xsteadfastx commented 1 year ago

followed it... so... im using the finduserhack branch and the password with the extracted tokens from #162 and get Invalid JSON response. or do i have to use your branch?

xsteadfastx commented 1 year ago

ok... i tried the branch from #162 and it worked fine :)

djhaskin987 commented 1 year ago
  1. Open web client
  2. Click on your picture in the upper right corner
  3. Select "Profile"
  4. Your URL bar should now have this in it: https://app.slack.com/client/<LONG_WEIRD_STRING>/<OTHER_LONG_WEIRD_STRING>/rimeto_profile/<LAST_LONG_WEIRD_STRING>
  5. Copy <LAST_LONG_WEIRD_STRING> from the URL and use it as your username in the pidgin field on the finduserhack branch
  6. Everything worked :D
djhaskin987 commented 1 year ago

I should note: I used #162 but when I did, pidgin never listed the people in the room. The feature of listing members of a channel was broken (EDIT: NOT BROKEN, just my settings were off), which is why I switched back to the finduserhack branch as in the workaround above.

djhaskin987 commented 1 year ago

However, when I do this, it prints my replies to people in conversations twice, which is annoying.

djhaskin987 commented 1 year ago

So, @dylex , a suggestion: In the finduserhack branch, please make it so that the "Local Account Alias" field is used for identifying messages that come in as the user, instead of the "username" field? Maybe.

vanquishedangel commented 1 year ago

I think I found the solution in #177

dchmelik commented 1 year ago

Where's 'the finduserhack branch'?

vanquishedangel commented 1 year ago

the find user hack is linked below but it is also on the main page for the pluging. Just look for "main" and click it and you get the option for a different branch, however it was confusing to me at first as well. Also if that does not work try the solution I found in #177.

https://github.com/dylex/slack-libpurple/commit/b0453c713f1c4f53a4ef30bc3b51f541f5c752c0

dchmelik commented 1 year ago

the find user hack is linked below but it is also on the main page for the pluging. Just look for "main" and click it and you get the option for a different branch, however it was confusing to me at first as well. Also if that does not work try the solution I found in

Well, the source code has changed since then. If it's in the new commit, it doesn't work for me, and if it isn't, I don't know that the line numbers are same so if the hack could still be used.

vanquishedangel commented 1 year ago

All good, you asked and I linked is all. You could try the solution it may work for you, just back up the file and save the old one. If it does not work just restore the file. Mine is not working after I used the member ID in place of the user name and used my regular password to log in.

gzuaps commented 1 year ago

just confirming that the finduserhack branch worked for a new workspace I was added to.

sahal commented 1 year ago

I've updated the AUR build for this package to use this branch as it does seem to work with some workspaces.

To login, I used my user id that I pulled from logging in at app.slack.com and my regular user password.

~Unfortunately, a public slack workspace that doesn't seem to work with this branch is: https://kubernetes.slack.com. The issue seems to be related to https://github.com/dylex/slack-libpurple/issues/81 as there are 150,000 users in this workspace.~ I was able to connect to large slack workspaces by using the "lazy loading option" under advanced settings in the account.

dchmelik commented 1 year ago

I see there have been commits since this--isn't it going to be pulled back into the main branch to fix current versions? Now the choice is either use the older fix with other bugs, or the newer ones without those but without slack...

vanquishedangel commented 1 year ago

I see there have been commits since this--isn't it going to be pulled back into the main branch to fix current versions? Now the choice is either use the older fix with other bugs, or the newer ones without those but without slack...

I may need some help with the lingo you used, but mine is working great. #177 worked, you need the member ID from your profile to use as your user name, then log in with your normal password.

I dont fully understand "commits" and I am not sure why it would interfere with using newer versions.

dchmelik commented 1 year ago

177 worked, you need the member ID from your profile to use as your user name, then log in with your normal password.

That's for pidgin;; doesn't work for other libpurple software such as bitlbee.

I dont fully understand "commits" and I am not sure why it would interfere with using newer versions.

A commit is uploaded through git and is a version that has a hexadecimal hash number (the recent commit of main branch is newer than the finduserhack branch which I forgot even existed as GitHub doesn't make this very clear).

tkasci commented 1 year ago

I would greatly appreciate if there was a fix for this plugin that makes it usable with bitlbee again.

dylex commented 1 year ago

I've cleaned up, lightly documented, and merged finduserhack since it seems to be working for most people, so I'll close this.

I'm not sure why this wouldn't work for bitlbee. What problem are you having? Are you sure it's related to this issue?

tkasci commented 1 year ago

I'm not sure why this wouldn't work for bitlbee. What problem are you having? Are you sure it's related to this issue?

I don't know but @dchmelik had this theory. The error persists if I use the Slack user ID that I retrieved from the web app. I also set the lazy_load option to TRUE.

[19:41] <@root> slack - Login error: unknown_method

Here is the full output:


[19:45] <@tim> account slack on
[19:45] <@root> slack - Logging in: Looking up team
[19:45] <@root> New request: Request: SSL Certificate Verification
[19:45] <@root>
[19:45] <@root> Accept certificate for slack.com?
[19:45] <@root>
[19:45] <@root> The certificate for slack.com could not be validated.
[19:45] <@root>
[19:45] <@root> The certificate is not trusted because no certificate that can verify it is currently
                trusted.
[19:45] <@root> You can use the yes/no commands to accept/reject this request.
[19:45] <@tim> yes
[19:45] <@root> Accepted: Request: SSL Certificate Verification
[19:45] <@root>
[19:45] <@root> Accept certificate for slack.com?
[19:45] <@root>
[19:45] <@root> The certificate for slack.com could not be validated.
[19:45] <@root>
[19:45] <@root> The certificate is not trusted because no certificate that can verify it is currently
                trusted.
[19:45] <@root> slack - Logging in: Finding user
[19:45] <@root> slack - Login error: unknown_method
[19:45] <@root> slack - Logging in: Signing off..
dylex commented 1 year ago

This was with the finduserhack branch with a username without an @ in it? Is it possible bitlbee is adding an @ to the username somehow?

tkasci commented 1 year ago

I just pulled the repository again and recompiled it. Now it works. Sorry, I somehow thought the fix was already incorporated long ago…