Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cthoyt/flask-dance-with-redirects
Extend Flask-Dance to handle URL redirects
https://github.com/cthoyt/flask-dance-with-redirects
flask flask-dance oauth oauth1 oauth2
Last synced: about 1 month ago
JSON representation
Extend Flask-Dance to handle URL redirects
- Host: GitHub
- URL: https://github.com/cthoyt/flask-dance-with-redirects
- Owner: cthoyt
- License: mit
- Created: 2024-07-04T18:40:44.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-04T18:59:06.000Z (6 months ago)
- Last Synced: 2024-11-27T07:50:12.655Z (about 1 month ago)
- Topics: flask, flask-dance, oauth, oauth1, oauth2
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flask-dance-with-redirects
This repository gives an example of how to extend [Flask-Dance](https://github.com/singingwolfboy/flask-dance)
to handle URL redirects when doing the OAuth2 dance for you.There's a quick note in https://flask-dance.readthedocs.io/en/latest/understanding-the-magic.html#finishing-the-dance
on how this can work in a different way, but it seems a bit magic. This demo is a bit more explicit and contains
a full example!First, you'll need to get API credentials for ORCID at https://orcid.org/developer-tools
and set up a redirect for https://0.0.0.0:8775/login/orcid/authorized. You can swap
out many different OAuth2 sources by using Flask-Dance - ORCID is just for demo purposes.Second, you'll need to clone the repository, install requirements, and create
security credentials to get your local server to (begrudgingly) run HTTPS:```shell
git clone https://github.com/cthoyt/flask-dance-with-redirects.git
cd flask-dance-with-redirects
python -m pip install -r requirements.txt# needed to make appropriate security credentials
brew install mkcert
brew install nss
mkcert localhost 127.0.0.1 ::1
mkcert -installpython app.py
```Finally, navigate to https://0.0.0.0:8775 to see the dance.
You can look inside `app.py` for more detailed instructions on what's going on.