Skip to content

Commit

Permalink
Merge pull request rusq#152 from rusq/i122-token-doc
Browse files Browse the repository at this point in the history
rusq#122: simplify token retrieval steps (thanks @mootari)
  • Loading branch information
rusq authored Oct 13, 2022
2 parents e1783d6 + 2f7ee91 commit d74d720
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ Messages that were conveyed with the donations:
- 25/01/2022: Stay away from `TheSignChef.com`_, ya hear, they don't pay what
they owe to their employees.

.. _Application: https://stackoverflow.com/questions/12908881/how-to-copy-cookies-in-google-chrome

.. _`Buy me a cup of tea`: https://www.paypal.com/donate/?hosted_button_id=GUHCLSM7E54ZW
.. _Telegram: https://t.me/slackdump
.. _Slack: https://slackdump.herokuapp.com/
Expand All @@ -235,7 +235,6 @@ Messages that were conveyed with the donations:
bulletin board links
.. _`TheSignChef.com`: https://www.glassdoor.com.au/Reviews/TheSignChef-com-Reviews-E793259.htm
.. _`Get cookies.txt Chrome extension`: https://chrome.google.com/webstore/detail/get-cookiestxt/bgaddhkoddajcdgocldbbfleckgcbcid

.. |go ref| image:: https://pkg.go.dev/badge/github.com/rusq/slackdump/v2.svg
:alt: Go Reference
Expand Down
48 changes: 35 additions & 13 deletions doc/login-manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,16 @@ TOKEN
#. In Firefox, under `Tools -> Browser Tools -> Web Developer tools` in the menu bar
#. In Chrome, click the 'three dots' button to the right of the URL Bar, then select
'More Tools -> Developer Tools'
#. Go to the Network tab
#. In the toolbar, switch to ``Fetch/XHR`` view.
#. Open any channel or private conversation in Slack. You'll see a
bunch of stuff appearing in Network panel.
#. In the list of requests, find the one starting with
``channels.prefs.get?``, click it and click on *Headers* tab in the
opened pane.
#. Scroll down, until you see **Form Data**
#. Grab the **token:** value (it starts with ``xoxc-``), by right
clicking the value and choosing "Copy Value".
#. Switch to the console tab.
#. Paste the following snippet and press ENTER to execute::

**If you don't see the token value** in Google Chrome - switch to `Payload` tab,
your token is waiting for you there.
JSON.parse(localStorage.localConfig_v2).teams[document.location.pathname.match(/^\/client\/(T[A-Z0-9]+)/)[1]].token

#. Token value is printed right after the executed command (it starts with
"``xoxc-``"), save it somewhere for now.

.. NOTE:: if you're having problems running the code snippet above, you can
get the token the conventional way, see Troubleshooting_ section below.

COOKIE
++++++
Expand Down Expand Up @@ -83,6 +80,31 @@ Setting up the application

#. Save the file and close the editor.

Troubleshooting
~~~~~~~~~~~~~~~

Getting token the hard way
++++++++++++++++++++++++++

#. Open your browser's *Developer Console*, as described in the TOKEN_ section
steps above.
#. Go to the Network tab
#. In the toolbar, switch to ``Fetch/XHR`` view.
#. Open any channel or private conversation in Slack. You'll see a
bunch of stuff appearing in Network panel.
#. In the list of requests, find the one starting with
``channels.prefs.get?``, click it and click on *Headers* tab in the
opened pane.
#. Scroll down, until you see **Form Data**
#. Grab the **token:** value (it starts with "``xoxc-``"), by right
clicking the value and choosing "Copy Value".

**If you don't see the token value** in Google Chrome - switch to `Payload` tab,
your token is waiting for you there.


[Index_]

.. _Index: README.rst
.. _Index: README.rst
.. _Application: https://stackoverflow.com/questions/12908881/how-to-copy-cookies-in-google-chrome
.. _`Get cookies.txt Chrome extension`: https://chrome.google.com/webstore/detail/get-cookiestxt/bgaddhkoddajcdgocldbbfleckgcbcid

0 comments on commit d74d720

Please sign in to comment.