This repository demonstrates how to add passkey login functionality to your T3 Stack application using Hanko Passkey API. Passkey authentication is a secure and user-friendly alternative to traditional password-based authentication, providing a seamless login experience for users.
For a detailed tutorial on implementing passkey login in your Solid.js app, refer to our blog post: How to add a passkey login to T3 Stack?
Before you begin, ensure you have the following:
- Node.js installed (version 20.0.0 or later)
- Hanko Passkey API key and tenant ID from Hanko Cloud
- DB URL. In this case we are using Supabase
Note: You'll need to create a Passkey Project on Hanko Cloud with the App URL
http://localhost:3000
. See our docs to learn how to setup a passkey project.
- Clone the repository
git clone https://github.com/teamhanko/t3-stack-with-passkeys.git
-
Set up environment variables
- Create a
.env
file in the root directory and add the following environment variables:
NEXTAUTH_SECRET=random-string NEXTAUTH_URL=http://localhost:3000 GITHUB_ID= GITHUB_SECRET_ID= DATABASE_URL=your-db-url PASSKEYS_API_KEY=your-hanko-passkey-api-key NEXT_PUBLIC_PASSKEYS_TENANT_ID=your-hanko-passkey-tenant-id
- Replace
your-hanko-passkey-api-key
andyour-hanko-passkey-tenant-id
with your actual Hanko Passkey API key and tenant ID.
- Create a
-
Install the dependencies using your preferred package manager (e.g.,
npm
,pnpm
,yarn
, orbun
). For this project, we've usedpnpm
:
pnpm install
- Start the development server:
pnpm dev
-
Start the application:
- Access the application by navigating to
http://localhost:3000
in your web browser.
- Access the application by navigating to
-
Sign up with GitHub.
-
Register a passkey:
- After logging in, register a passkey for the logged-in user.
-
Log out:
- After the passkey registration is successful, log out of the application.
-
Login with with a passkey
- On the login page, choose sign in with a passkey option to authenticate using a passkey.
Feel free to reach out to us on Discord if you get into any issues.
This project is licensed under the MIT License.