Sample protected Flask webapp using Keycloak
- Docker
- Python 3.7
- Pip
pip install -r requirements.txt
docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin quay.io/keycloak/keycloak:13.0.1
- Open Keycloak at http://localhost:8080/auth/admin
- Use the credentials admin/admin to log in
- Create a new realm named sample-realm
- Create a new client named sample-client using the openid-connect protocol
- Make sure that the client has the access type set to public.
- public: used by client-side clients that are accessing the application via a browser.
- confidential: used by server-side clients that need to access the applicaton via a browser, and it requires a secret to turn an access code into an access token.
- bearer-only: accepts only bearer tokens, so a browser login is not possible.
- Use a star wildcard to allow redirecting to all endpoints in the Valid Redirect URIs field
- Create a new user and set the username and email
- Set the password in the credentials tab
- Run the python application
python app.py
- Open the browser at http://localhost:5000
- Log in using the username/password created for the user in Keycloak