This project implements a web application with a login using Corbado's passkey-first authentication service integrated with a FastAPI backend. The application consists of two main pages: a login page and a home page. Once users log in successfully via the Corbado on the login page, they are redirected to the home page where they can log out and view protected content.
Please see the full blog post to understand all the required steps to integrate passkeys into FastAPI apps.
- FastAPI: A full-featured Python web framework, used to build the backend of the application.
- Corbado: An authentication service used to handle passkey-first user authentication.
- HTML & CSS: Used to structure and style the frontend of the application.
- Passkey-first Authentication: Utilizes Corbado's authentication service for secure user login.
- Session management: Uses Corbado's session management to display content based on the user's authentication status.
├── .env # Contains all environment variables
├── main.py # Contains our webapplication (Handles routes)
└── templates
├── index.html # Login page
└── profile.html # Profile page
Clone this repository to your local machine by running:
git clone https://github.com/corbado/example-passkeys-fastapi
To configure the credentials, you will need to create a .env
file with your Corbado Project ID
and API secret
:
To get your Project ID
and API secret
, visit the Corbado developer panel.
Please refer to the Corbado docs for more details on obtaining the necessary credentials and integrating Corbado authentication in your application.
PROJECT_ID=<your-project-id>
API_SECRET=<your-api-secret>
In the Corbado developer panel, visit the URLs settings and enter the values shown in the image below:
Use the following command to run the project in a docker container:
docker compose up
After step 2.4, your local server should be fully working.
If you now visit http://localhost:3000, you should be able to sign up using the Corbado UI component.
When authenticated you will be forwarded to the /profile
page.