I connected to my first workspace a couple weeks ago without issue.
Now I want to add another one.
/slack register opens up a page that gives me an error saying
Something went wrong when authorizing wee-slack.
redirect_uri must not contain anchor (#) tags. Passed URI: https://wee-slack.github.io/wee-slack/oauth#
So I went and changed the URL to have a %2 instead of a %23, which caused the workspace page to load correctly for requesting access.
But when I click "Allow", I just get a 404.
So something is messed up with the URLs?
Meh, Slack has made their OAuth implementation stricter. Anchor tags are technically not allowed according to the specification, but Slack did allow them, so wee-slack used it to prevent the OAuth code from being leaked to GitHub Pages, which hosts the page you end up on after clicking Allow.
I'll have to think about what to do with this, but in the meantime you can copy out the code parameter from the URL, and call /slack register with that. So after you click allow, you will end up on a page with a URL like this:
https://wee-slack.github.io/wee-slack/oauth?code=3231593616.2191456154451.e07910a06a086c83ba41827aa00b26edd8e8fca2dc0f896fd7cb4cb0031ba249&state=
Then run this command in WeeChat:
/slack register 3231593616.2191456154451.e07910a06a086c83ba41827aa00b26edd8e8fca2dc0f896fd7cb4cb0031ba249
Replacing that value with the one from your URL.
So I went and changed the URL to have a %2 instead of a %23, which caused the workspace page to load correctly for requesting access.
You have to remove the whole of %23, not just the 3. That will land you on the correct page, but it won't work correctly, so you have to pull out the code of the URL like mentioned above. Note that this will leak the code to GitHub Pages, though I don't think it's a big deal, since the code is only valid for a short period (this is just a code used to create the token, the token won't be leaked). But if you are worried about that, you can use this URL instead: https://slack.com/oauth/authorize?client_id=2468770254.51917335286&scope=client&redirect_uri=http%3A%2F%2Fnot.a.realhost%2F
Thanks for the quick feedback.
I entered /slack register <code from URL> and weechat gives me
ERROR: Couldn't get Slack OAuth token: bad_redirect_uri.
This is with the code from the 404 page, after I click allow.
Ah, I forgot that redirect_uri was used in that part as well. Then you have to remove %23 in the script as well. That is, change this line:
To
```
REDIRECT_URI = "https%3A%2F%2Fwee-slack.github.io%2Fwee-slack%2Foauth"
````
And run /python reload slack.
Works great, thanks!
Most helpful comment
Ah, I forgot that
redirect_uriwas used in that part as well. Then you have to remove%23in the script as well. That is, change this line:https://github.com/wee-slack/wee-slack/blob/7e06c3457e9be199c6cad359a0b5b4c0f7447fc9/wee_slack.py#L3921
To
```
REDIRECT_URI = "https%3A%2F%2Fwee-slack.github.io%2Fwee-slack%2Foauth"
````
And run
/python reload slack.