Skip to content

fuegoio/fastapi-frontend-auth-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI and frontend auth example

This repository is an example for a FastAPI projet with a frontend, demonstrating how auth with an exernal OAuth provider should work. It is associated to the article Demystifying authentication with FastAPI and a frontend on Kernel Panic.

On this example, it is possible to login with Github OAuth app.

Getting started

To launch this projet, you may need a PostgreSQL database, that is included in the docker-compose.yml file. You can launch it with:

$ docker-compose up -d

Backend

To run the backend, you need to create a virtualenv and use Poetry for dependency management:

$ virtualenv venv --python=python3.8
$ source venv/bin/activate
$ poetry install

Then, you need to set up your Github client id and secret in a .env file:

GITHUB_CLIENT_ID=<your-client-id>
GITHUB_CLIENT_SECRET=<your-client-secret>

And you can launch the backend with:

$ uvicorn app.main:app --reload

Frontend

To run the frontend, you need to install the dependencies:

$ npm install

Then, you can launch it with:

$ npm run serve

And access it on the http://localhost:8080 and login !

About

Example for a FastAPI projet with a frontend, demonstrating how auth with an exernal OAuth provider should work.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published