I'm stalled midway through the Slack oauth process and could use some help. I have the Add to Slack button added to my website, and the next step according to the documentation is to retrieve a temporary code:
If the user authorizes your app, Slack will redirect back to your specified redirect_uri with a temporary code in a code GET parameter
This code is need for the call to oauth.access, which will return the token I need. The Add to Slack button works as intended and sends me to a URL containing the code, but I can't figure out how to programmatically retrieve it using Python 3.5. I've been experimenting with the urllib library (https://docs.python.org/3/library/urllib.request.html#urllib.request.HTTPRedirectHandler) as well as the requests library.
The root of my problem is that I need to retrieve a code from an unknown URL. Here's a link to the documentation I'm reading: https://api.slack.com/docs/oauth
Any help or guidance is much appreciated!
From the Slack Documentation:
Step 2 - Token Issuing
If the user authorizes your app, Slack will redirect back to your specifiedredirect_uri
with a temporary code in acode
GET parameter
Once you have authorized your app in the OAuth consent screen, Slack redirects you to the redirect_uri
you passed to it in Step 1 or the one you set in the App configuration page.
On the server-side you will then need to read the code
GET parameter to complete the OAuth Flow.
Here is a gist, which shows how to do basic Slack OAuth with Django: https://gist.github.com/xoneco/43cd18d5b991b8f5e288
Line 27 onwards shows how you can implement the redirect_uri
endpoint and finish the OAuth Flow.