Example of getting auth tokens from the OAuth2 Mock server
We will use [https://github.com/navikt/mock-oauth2-server](Navikt's Mock Oauth2 Server) to back this example. In particular, this guide will walk you through:
1) Starting up the Docker OAuth2 server with appropriate settings. 2) Using Python to authenticate a test user against this server.
First, pull the docker image with:
docker pull ghcr.io/navikt/mock-oauth2-server:2.1.10
You can now run the server with:
docker run -p 8080:8080 ghcr.io/navikt/mock-oauth2-server:2.1.10
Note that, if the server is running in this way, we can get a login page by sending, e.g., a request to this url.
virtualenv venv -p python3
pip install -r requirements.txt
venv/bin/python example_auth.txt