OAuth 2 only works with SSL, so the application should run with HTTPS. To do this on a local machine, please follow these steps:
- Install pyopenssl using the $ pip3 install pyopenssl command.
- Add additional options to app.run() , including ssl_context with the value adhoc. The completed app.run should look as follows:
app.run(debug=True, ssl_context='adhoc').
- Once these changes have been made, run the application using the URL https://localhost:5000/. Before the app loads, your browser will display warnings about the certificate not being safe. Just accept the warning and proceed.
This is not a recommended method. In production systems, SSL certificates should be obtained from a proper certifying authority.
To install Flask-Dance ...