daserzw / oauth2-client

Simple OAuth2 Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OAuth2 Course - Simple Client

This very simple OAuth2 client implements the OAuth2 Authorization Code Grant, showing each HTTP request/response between the Client, the Authorization Server, and finally the Resource Server. It can be freely used in courses about OAuth2.

How to run

In order to use this simple client, open config.py and setup:

  • a SECRET_KEY (see instruction in config.py)
  • an Authorization Server Authorization Endpoint in AS_AUTH_URL (or uncomment the Github one)
  • an Authorization Server Token Endpoint (or uncomment the Github one)
  • a Resource Server API URL (or uncomment the Github one)
  • OAuth2 CLIENT_ID and CLIENT_SECRET (provided by your Authorization Server)
  • the OAuth2 Client REDIRECT_URI, composed by your base URL + ':9000/cb'

Virtualenv

We strongly reccomend to use virtualenv to set up the python environment to run the Flask app:

cd oauth2-client
python3 -mvenv venv

Activate the virtualenv

. venv/bin/activate

With the venv activated, install all the required python modules

pip install -r requirements.txt

Once everything is set up you can run the Flask app:

python run.py

Enjoy!

About

Simple OAuth2 Client


Languages

Language:HTML 54.1%Language:Python 45.9%