http://localhost にアクセスして Web アプリを開発していたとします。OAuth2 を組み込んだ場合、https しか受け付けてくれない場合があります。ngrok を使って https アクセスできるようにしてみました。
ngrok のインストール
brew install ngrok
ngrok config add-authtoken <your authtoken>
Flask アプリを用意
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello, World!'
if __name__ == '__main__':
app.run(port=8080, debug=True)
Flask アプリを起動
$ python3 app.py
* Serving Flask app 'app'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:8080
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 730-497-713
ngrok を起動
$ ngrok http 8080
ngrok (Ctrl+C to quit)
Build better APIs with ngrok. Early access: ngrok.com/early-access
Session Status online
Account user (Plan: Free)
Version 3.5.0
Region Japan (jp)
Latency 13ms
Web Interface http://127.0.0.1:4040
Forwarding https://0000-111-222-333-444.ngrok-free.app -> http://localhost:8080