Hi Juan,
Sorry that I can’t be of much help with your question, but I would love to help
with testing what you come up with. It would be great to have a more accessible
desktop option for Slack as we have fully adopted it at my workplace.
Matthew
On Nov 15, 2018, at 8:28 PM, Juan Hernandez <juanhernandez98@xxxxxxxxx> wrote:
Hi All,
I’m developing an alternative slack client that is far more accessible than
the slack client that is released directly by slack.
One issue I’m having and this just because I haven’t done much in the past
with Flask, is the instructions say to create a web server using flask for
slack.
Here is the instructions at:
https://slackapi.github.io/python-slackclient/auth.html ;
<https://slackapi.github.io/python-slackclient/auth.html>
Now, here is my webserver.py file :
# controler / webserver.py
import os
from flask import Flask, request
from slackclient import SlackClient
import controler.config as cfg
app_oauth_scopes = [
"client",
"channels:read",
"channels:write",
"channels:history",
"chat:read:user",
"chat:write:user",
"dnd:read",
"dnd:write",
"dnd:write:user",
"emoji:read",
"groups:history",
"groups:read",
"groups:write",
"identity.basic",
"identity.basic:user",
"im:history",
"im:read",
"im:write",
"team:read",
]
client_id = cfg.slack_client_id
client_secret = cfg.slack_client_secret
app = Flask(__name__)
@app.route("/begin_auth", methods=["GET"])
def preinstall():
return '''
<a
href="https://slack.com/oauth/authorize?scope={0}&client_id={1}";>Sign In to
Slack</a>
'''.format(app_oauth_scopes, client_id)
# end function begin_oauth
@app.route("/finish_auth", methods=["GET", "POST"])
def postinstall():
# Retrieve the auth code from the request params
auth_code = request.args['code']
# An empty string is a valid token for this request
sc = SlackClient("")
# Request the auth tokens from Slack
auth_response = sc.api_call(
"oauth.access",
client_id=client_id,
client_secret=client_secret,
code=auth_code
)
return auth_response
can someone please explain how this is to be used? In the past I’ve seen that
applications launch a web browser, with a sign into slack button, and then it
takes mme to slack. How can I duplicate this process? How is this webserver
used? This is frustrating as my slack client is starting to come together.
I’m testing with a ttest token, and now I want to release it to a test group
so they can try it out.
Thanks for any help.