76

In the app, going File > Workspace > Sign in to new workspace launches a browser window. After selecting the workspace in browser, it launches back a deep link back to slack but it doesn't work. Nothing happens on the slack-desktop.

When inspecting the commands being run during the linking process it looks like KDE is modifying the link. What do I do to fix this?

reka18
  • 7,440
  • 5
  • 16
  • 37
Boon
  • 1,871
  • 1
  • 21
  • 31
  • In my case it was something stupid: I had **http_proxy** configured, but no proxy running. So Slack couldn't connect, without any explanation, but Chrome ignores http_proxy, so it appeared to work fine. – rustyx Sep 01 '22 at 19:47
  • 7
    The simplest solution I've found is going to this url: https://[yourworkspace].slack.com/ssb/signin_redirect/fallback There you can copy a magic link that the Slack desktop application will read from clipboard when you switch to it. I sometimes have to give it a couple tries, but it has always worked eventually :) – aweibell Apr 27 '23 at 19:09

6 Answers6

149

The answer provided by Boon is correct. I wanted to leave comment under that answer but apparently I need 50 points to comment so I can only add new answer...

After digging into the matter it sounds like the kde-open5 from kde-cli-tools is doing some funky lower-casing on first element of URL (slack://A/B/C becomes slack://a/B/C). This sounds like an old bug: https://bugs.kde.org/show_bug.cgi?id=429408

I suspect that slack changed in how they handle the links/links has changed - it aligns with slack upgrade in my case: slack-desktop:amd64 from 4.22.0 to 4.23.0.

Looking at process list:

  • the slack website asks browser to open link with upper case
  • kde-open5 is run with correct link
  • slack is run with lower-cased workspace

I've reported this to slack with all the details so I hope it will be fixed.

Workaround:

Just adding some details to what (Boon suggested)

  1. Run the quick script in bash:
while sleep .1; do ps aux | grep slack | grep -v grep | grep magic; done
  1. Try logging in to slack - accept login attempt in browser

  2. You should see login link in console:

kde-open5 slack://WORKSPACE_ID/magic-login/...
/usr/lib/slack/slack --enable-crashpad slack://workspace_id/magic-login/...
  1. Open the slack with correct link:
/usr/lib/slack/slack --enable-crashpad slack://WORKSPACE_ID/magic-login/...
Aleksander Mierzwicki
  • 1,506
  • 1
  • 3
  • 3
  • 4
    thx. I added a comment in the KDE bug tracker: https://bugs.kde.org/show_bug.cgi?id=429408#c3 – Egon Willighagen Mar 05 '22 at 07:48
  • In some linuxes /usr/lib/slack/slack is just /usr/bin/slack – 42n4 Mar 30 '22 at 13:49
  • 3
    `/snap/bin/slack` for Slack installed from snap store – Aamir May 09 '22 at 07:15
  • In my case, I was using Firefox and got it working after selecting the Slack app directly as the application to open Slack links - I guess, that goes around kde-open5 and thus solves it as well – Nico Kruber May 09 '22 at 08:03
  • 1
    The only viable workaround does actually involve some shell programming, so the question IS appropriate for StackOverflow after all. – Szczepan Hołyszewski May 25 '22 at 09:10
  • And if you see the URL in the web browser, you can see the salck id, so you can copy and paste on the magic-login, and is the same, if you couldn-t find the uppercase url. – Daniel Ballesteros Aug 01 '22 at 14:04
  • 2
    Note all you need to do is select the magic link and copy it to your clipboard. When you swap to slack, it will then automatically log in. – jsravn Aug 16 '22 at 09:08
  • My solution on KDE was to switch default browser to firefox. The problem only occurs with chromium. – Julien Pilet Mar 02 '23 at 10:46
  • So poking around the source code - the host part of the slack:// url is being lower-cased as per https://code.woboq.org/kde/qt4/src/corelib/io/qurl.cpp.html#179 RFC 3491. So this is really a bug I think in slack, they should not use the host part of the url for a case-sensitve ID. – Matt Billenstein Mar 24 '23 at 14:10
  • Thanks alot, I tried so many solutions but this one worked – crimson suv May 02 '23 at 14:46
  • I've been using Slack in my browser for weeks. I hate it. This worked!!!! – DevOpsSauce May 08 '23 at 13:09
  • id like to add that it doesnt work for snap slack – Alex Jul 27 '23 at 11:36
95

I'm using Archlinux, and neither clicking on link didn't work, neither passing link to slack arguments. Also you can find a correct link if you open dev console in browser it should be in console output. If you copy this link to your clipboard (ctrl+c) and then you switch to your slack app. It seems like onFocus slack automatically reads the clipboard and process it if it's a link. That gets be logged in. enter image description here

deathangel908
  • 8,601
  • 8
  • 47
  • 81
39

Thanks to the excellent analysis of the issue here, I managed to create a script that saves me from this issue.

#!/usr/bin/env bash

if [[ "${1:-}" = slack://* ]]; then
    exec /usr/lib/slack/slack --enable-crashpad "$1"
fi

exec /usr/bin/xdg-open "$@"

Save the above script as /usr/local/bin/xdg-open and make the script executable. That's it!

I really hope the KDE team shows some love for such a fundamental issue, especially considering how widely used Slack is.

ϹοδεMεδιϲ
  • 2,790
  • 3
  • 33
  • 54
  • 2
    In some linuxes /usr/lib/slack/slack is just /usr/bin/slack – 42n4 Mar 30 '22 at 13:49
  • 1
    Clever! Much more refined solution than polling `ps` output. Verified on base Kubuntu 22.04. As noted, you'll need to use the `/usr/bin` prefix if you installed via official `.deb` package from slack.com – ardnew May 05 '22 at 00:00
  • 1
    @trulyliu I am not sure where to add that snippet of code. The solution above would do everything for you. It overrides the system-wide `xdg-open`, just for slack. All you have to make sure is the paths for `slack` and the original `xdg-open` are correct. I didn't want to mess about with the string because I was uncertain whether it would be mixed case or not. – ϹοδεMεδιϲ Jul 08 '22 at 10:11
  • Great approach, saved me!, thanks so much – jjo Mar 14 '23 at 14:24
16

Faced the same problem in Kubuntu 20.04 and the Chrome browser. Firefox solved this issue)

Pavel
  • 169
  • 1
  • 2
14

After trying various things, I noticed that what I suspect to be the workspace id, tlvs8sasf above are often in CAPS in the logs.

So, I tried updating the deep link by upper casing the workspace id, then click on it. Voila, it worked for me. Hope this helps anyone else also suffering from this same issue.

Boon
  • 1,871
  • 1
  • 21
  • 31
7

I have this problem almost every time I restart my computer, and I have some 10 active slack workspaces, so hacked a quick bash script to do the caps trick for me. It's not meant to be robust, but it works. I'll leave it here in case it's useful for anybody else.

# Workaround to get slack to open workspaces correctly.
# Problem and workarond concept as described here:
# https://stackoverflow.com/questions/70867064/signing-into-slack-desktop-not-working-on-4-23-0-64-bit-ubuntu
# Usage: Run this script, open slack as normal, and attempt to log into workspaces as normal. Once done, kill the script.

while sleep .1; do 
        line=$(ps ax | grep slack | grep -v grep | grep magic | awk '{ print $NF }')
        WD=$(echo $line | cut -d '/' -f 3 | tr [:lower:] [:upper:])
        LN=$(echo $line | cut -d '/' -f 5)
        if [ "$WD" != "" ]; then
                echo "got $line"
                line2="slack://$WD/magic-login/$LN"
                echo "Attempting to open $line2"
                /usr/lib/slack/slack --enable-crashpad $line2
        fi
done | grep -v "^$"
Germán Sanchis
  • 629
  • 6
  • 6