#!/usr/bin/env python

# Standard library.
from os.path import abspath, dirname, join

# 3rd party library.
from flask import Flask, redirect, url_for
from flask_dance.contrib.slack import make_slack_blueprint, slack
import yaml

HERE = dirname(abspath(__file__))

def get_app_config():
    path_to_yaml = join(HERE, '..', 'config.yaml')
    with open(path_to_yaml, 'r') as ymlfile:
        web = yaml.load(ymlfile).get('web')

    if not web:
        web = {'client_id': '', 'client_secret': '', 'secret_key': ''}

    return web

## NOTE: When running locally, export OAUTHLIB_INSECURE_TRANSPORT=1
## See: http://flask-dance.readthedocs.org/en/latest/quickstarts/slack.html

config = get_app_config()
app = Flask(__name__)
app.secret_key = config['secret_key']
blueprint = make_slack_blueprint(
    client_id=config['client_id'],
    client_secret=config['client_secret'],
    scope=["identify", "chat:write:bot"],
)
app.register_blueprint(blueprint, url_prefix="/login")

@app.route("/")
def index():
    if not slack.authorized:
        return redirect(url_for("slack.login"))
    return 'Hello, there!'

if __name__ == "__main__":
    app.run(debug=True)

@@ -429,31 +429,15 @@
     
-if not web:%0A        web
+default
  = %7B
@@ -492,17 +492,16 @@
 y': ''%7D%0A
-%0A
     retu
@@ -510,153 +510,20 @@
  web
-%0A%0A## NOTE: When running locally, export OAUTHLIB_INSECURE_TRANSPORT=1%0A## See: http://flask-dance.readthedocs.org/en/latest/quickstarts/slack.html
+ or default%0A
 %0A%0Aco
@@ -952,16 +952,18 @@
 here!'%0A%0A
+%0A%0A
 if __nam
@@ -989,24 +989,444 @@
     
-app.run(debug=True
+# See: http://flask-dance.readthedocs.org/en/latest/quickstarts/slack.html%0A    # openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout web.key -out web.crt%0A    # NOTE: When running locally, export OAUTHLIB_INSECURE_TRANSPORT=1 if you%0A    # don't want to create certificates, etc. Comment the context from below.%0A    context = (join(HERE, 'keys', 'web.crt'), join(HERE, 'keys', 'web.key'))%0A    app.run(debug=True, ssl_context=context
 )%0A

Add ssl context for the app.