workos / authkit

The world's best login box powered by WorkOS and Radix.
https://authkit.com
MIT License
2.3k stars 89 forks source link
auth authentication authentication-backend authentication-middleware authn magic-code oauth2 passwordless-authentication radix-ui sso-authentication user-management

AuthKit

How to use AuthKit's hosted UI or build your own frontend with the headless User Management APIs

Explore the docs ↗

Screenshot of hosted UI AuthKit in light mode

Examples

There are two ways to use AuthKit and this repository contains examples for both:

Prerequisites

You will need a WorkOS account.

Running the example

  1. Install dependencies with npm install or yarn install

  2. Set up your Environment variables by signing into your WorkOS dashboard, navigate to API Keys and copy the Client ID and the Secret Key (API Key). Rename the .env.local.example file to .env.local and supply your Client ID and Secret Key.

    WORKOS_CLIENT_ID="<your Client ID>"
    WORKOS_API_KEY="<your Secret Key>"
  3. Configure redirects in your WorkOS dashboard, navigate to Redirects and add the following urls:

    http://localhost:3000/using-your-own-ui/sign-in/google-oauth/callback
    http://localhost:3000/using-your-own-ui/sign-in/microsoft-oauth/callback
    http://localhost:3000/using-your-own-ui/sign-in/github-oauth/callback
    http://localhost:3000/using-your-own-ui/sign-in/sso/callback
    http://localhost:3000/using-hosted-authkit/basic/callback
    http://localhost:3000/using-hosted-authkit/with-session/callback
    http://localhost:3000/using-hosted-authkit/with-nextjs/callback
  4. Run the example with npm run dev or yarn dev and navigate to http://localhost:3000