Skip to content

This repository illustrates how we can integrate keycloak with fastAPI for authetification

License

Notifications You must be signed in to change notification settings

ilyesAj/keycloak-fastAPI-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

keycloak-fastAPI-integration

This repository illustrates how we can integrate keycloak with fastAPI for authetification. This repo can be used as a template/code base for your app .

setup env

I used pipenv for my env setup.

  1. install pipenv
  2. install dependencies using pipenv install
  3. run keycloak instance using:
docker run -p 8080:8080 -v ./keycloak/keycloak_data:/opt/keycloak/data/h2 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:22.0.3 start-dev
  1. now you can run your fastAPI app using pipenv run python main.py

Demo

  1. access to fastAPI swagger using http://127.0.0.1:8081/docs
  2. get token using authorize
  3. make your query for /secure demo

About

This repository illustrates how we can integrate keycloak with fastAPI for authetification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages