AuthKit: Streamlined Authentication with WorkOS and Radix
Summary
AuthKit is an open-source login box solution developed by WorkOS, designed to simplify authentication for applications. It offers both a fully themeable hosted UI and headless APIs for custom frontends, powered by WorkOS User Management and Radix UI. This TypeScript project supports various authentication flows, including OAuth2, passwordless, and SSO.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
AuthKit, developed by WorkOS, provides a robust and flexible solution for implementing authentication in your applications. Described as "the world's best login box," it leverages WorkOS User Management and Radix UI to offer a seamless and secure user experience. Whether you prefer a quick-to-deploy hosted UI or a custom frontend integration, AuthKit simplifies complex authentication flows.
Installation
To get started with AuthKit, you'll need a WorkOS account. Once you have an account, follow these steps to run the examples:
- Install Dependencies: Run
npm installoryarn installin the repository. - Set up Environment Variables:
- Sign into your WorkOS dashboard.
- Navigate to API Keys and copy your Client ID and Secret Key (API Key).
- Rename
.env.local.exampleto.env.localand populate it with your keys:WORKOS_CLIENT_ID="<your Client ID>" WORKOS_API_KEY="<your Secret Key>"
- 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/callbackhttp://localhost:3000/using-your-own-ui/sign-in/microsoft-oauth/callbackhttp://localhost:3000/using-your-own-ui/sign-in/github-oauth/callbackhttp://localhost:3000/using-your-own-ui/sign-in/sso/callbackhttp://localhost:3000/using-hosted-authkit/basic/callbackhttp://localhost:3000/using-hosted-authkit/with-session/callbackhttp://localhost:3000/using-hosted-authkit/with-nextjs/callback
- Run the Example: Execute
npm run devoryarn devand openhttp://localhost:3000in your browser.
Examples
AuthKit offers two primary methods for integration, both with examples provided in the repository:
- Using AuthKit's hosted UI: This is the quickest way to add authentication. It provides a fully themeable hosted UI that manages all authentication flows. For production, you can use a custom domain.
- Using your own custom UI: For full control over the user interface, you can build your own frontend by integrating directly with the headless WorkOS User Management APIs. Your authentication UI will be self-hosted.
Why use AuthKit
AuthKit simplifies the complex task of user authentication, offering a comprehensive suite of features out-of-the-box. Its flexibility allows developers to choose between a ready-to-use hosted solution or a customizable headless API approach. With support for various authentication methods like OAuth2, passwordless, and SSO, and built on reliable technologies like WorkOS and Radix UI, AuthKit provides a secure, scalable, and developer-friendly way to manage user logins.