Using Drizzle ORM|/guidebook/drizzle-orm|Learn how to use Drizzle ORM with Lucia||Email verification codes|/guidebook/email-verification-codes|Learn how to verify emails with one-time passwords||Email authentication with verification links|/guidebook/email-verification-links|Extend Lucia by implementing email and password authentication with email verification links||Github OAuth in Electron|/guidebook/github-oauth-native/electron|Learn how to implement Github OAuth in Electron desktop applications||Github OAuth in Expo|/guidebook/github-oauth-native/expo|Learn how to implement Github OAuth in Expo mobile applications||Github OAuth in native applications|/guidebook/github-oauth-native|Learn how to implement Github OAuth in desktop and mobile applications||Github OAuth in Tauri|/guidebook/github-oauth-native/tauri|Learn how to implement Github OAuth in Tauri desktop applications||GitHub OAuth|/guidebook/github-oauth|Learn the basic of Lucia and the OAuth integration by implementing GitHub OAuth||Improving session security|/guidebook/improve-session-security|Learn how to configure and extend Lucia to improve security||Using Kysely|/guidebook/kysely|Learn how to use Kysely with Lucia||Login throttling|/guidebook/login-throttling|Prevent password brute force attacks with login throttling||OAuth account linking|/guidebook/oauth-account-linking|Learn how to link multiple providers to a single user||Password reset links|/guidebook/password-reset-link|Learn how to implement password reset using reset links||Sign in with username and password|/guidebook/sign-in-with-username-and-password|Learn the basic of Lucia by implementing a basic username and password authentication||Using @vercel/postgres|/guidebook/vercel-postgres|Learn how to use @vercel/postgres with Lucia||Configuration|/basics/configuration|Learn how to configure Lucia|required:Required\adapter:adapter\env:env\optional:Optional\csrfprotection:csrfProtection\getsessionattributes:getSessionAttributes()\getuserattributes:getUserAttributes()\middleware:middleware\passwordhash:passwordHash\sessioncookie:sessionCookie\sessionexpiresin:sessionExpiresIn\experimental:Experimental\debugmode:debugMode|Database|/basics/database|Learn how your database works with Lucia|database-adapters:Database adapters\database-model:Database model\user-table:User table\session-table:Session table\key-table:Key table|Error handling|/basics/error-handling|Learn about error handling in Lucia||Falling back to database queries|/basics/fallback-database-queries|Learn how to use database queries when Lucia's API isn't enough|create-users-and-keys:Create users and keys\transform-database-objects:Transform database objects|Handle requests|/basics/handle-requests|Learn how to handle and validate incoming requests with Lucia|list-of-middleware:List of middleware\lucia-default:Lucia (default)\astro:Astro\elysia:Elysia\express:Express\fastify:Fastify\h3:H3\hono:Hono\nextjs:Next.js\nodejs:Node.js\qwik:Qwik\sveltekit:SvelteKit\web-standard:Web standard|Keys|/basics/keys|Learn about keys in Lucia|examples:Examples\create-keys:Create keys\create-keys-when-creating-users:Create keys when creating users\case-sensitivity:Case sensitivity\password-hashing:Password hashing\validate-keys:Validate keys\get-keys:Get keys\get-all-keys-of-a-user:Get all keys of a user\update-key-password:Update key password\delete-keys:Delete keys|Sessions|/basics/sessions|Learn about sessions in Lucia|session-id:Session id\session-states-and-session-reset:Session states and session reset\validating-requests:Validating requests\defining-session-attributes:Defining session attributes\create-sessions:Create sessions\session-attributes-errors:Session attributes errors\validate-sessions:Validate sessions\get-sessions:Get sessions\get-all-user-sessions:Get all user sessions\invalidate-sessions:Invalidate sessions\invalidate-all-user-sessions:Invalidate all user sessions\update-session-attributes:Update session attributes\delete-dead-user-sessions:Delete dead user sessions\configuration:Configuration|Users|/basics/users|Learn about users in Lucia|user-id:User id\user-attributes:User attributes\defining-user-attributes:Defining user attributes\create-users:Create users\user-attributes-errors:User attributes errors\custom-user-id:Custom user id\get-user:Get user\update-user-attributes:Update user attributes\delete-users:Delete users\configuration:Configuration|Using bearer tokens|/basics/using-bearer-tokens|Learn how to use bearer tokens with Lucia|validate-bearer-tokens:Validate bearer tokens\read-bearer-tokens:Read bearer tokens\caching:Caching\invalidation:Invalidation|Using cookies|/basics/using-cookies|Learn how to use session cookies with Lucia|security:Security\cookie-expiration:Cookie expiration\validate-session-cookies:Validate session cookies\read-session-cookie:Read session cookie\caching:Caching\invalidation:Invalidation\set-session-cookies:Set session cookies\create-session-cookies:Create session cookies\using-an-external-backend:Using an external backend|Contributing|/contributing|Learn how to contribute to Lucia|forking-the-project:Forking the project\prerequisites:Prerequisites\set-up:Set up\documentation:Documentation\examples:Examples\source-code:Source code\changesets:Changesets\oauth-provider:OAuth provider\database-adapters:Database adapters\style-guide:Style guide\recommendation:Recommendation|better-sqlite3 adapter|/database-adapters/better-sqlite3|Learn how to use better-sqlite3 with Lucia|installation:Installation\usage:Usage\sqlite3-schema:SQLite3 schema\user-table:User table\key-table:Key table\session-table:Session table|Cloudflare D1 adapter|/database-adapters/cloudflare-d1|Learn how to use Cloudflare D1 with Lucia|installation:Installation\usage:Usage\sqlite3-schema:SQLite3 schema\user-table:User table\key-table:Key table\session-table:Session table|ioredis session adapter|/database-adapters/ioredis|Learn how to use ioredis with Lucia|installation:Installation\key-prefixes:Key prefixes\usage:Usage|libSQL adapter|/database-adapters/libsql|Learn how to use libSQL with Lucia|installation:Installation\usage:Usage\libsql-schema:libSQL schema\user-table:User table\key-table:Key table\session-table:Session table|Mongoose adapter|/database-adapters/mongoose|Learn how to use Mongoose with Lucia|installation:Installation\usage:Usage\mongoose-models:Mongoose models\user-collection:User collection\key-collection:Key collection\session-collection:Session collection|mysql2 adapter|/database-adapters/mysql2|Learn how to use mysql2 with Lucia|installation:Installation\usage:Usage\mysql-schema:MySQL schema\user-table:User table\key-table:Key table\session-table:Session table|pg adapter|/database-adapters/pg|Learn how to use pg with Lucia|installation:Installation\usage:Usage\postgresql-schema:PostgreSQL schema\user-table:User table\key-table:Key table\session-table:Session table|PlanetScale serverless adapter|/database-adapters/planetscale-serverless|Learn how to use the PlanetScale serverless driver with Lucia|installation:Installation\usage:Usage\mysql-schema:MySQL schema\user-table:User table\key-table:Key table\session-table:Session table|postgres adapter|/database-adapters/postgres|Learn how to use postgres with Lucia|installation:Installation\usage:Usage\postgresql-schema:PostgreSQL schema\user-table:User table\key-table:Key table\session-table:Session table|Prisma adapter|/database-adapters/prisma|Learn how to use Prisma with Lucia|installation:Installation\usage:Usage\in-non-nodejs-environment:In non-Node.js environment\prisma-schema:Prisma schema|Redis session adapter|/database-adapters/redis|Learn how to use Redis with Lucia|installation:Installation\key-prefixes:Key prefixes\usage:Usage|Unstorage session adapter|/database-adapters/unstorage|Learn how to use Unstorage with Lucia|installation:Installation\key-prefixes:Key prefixes\usage:Usage|Upstash Redis adapter|/database-adapters/upstash-redis|Learn how to use Upstash Redis with Lucia|key-prefixes:Key prefixes\usage:Usage|Getting started|/getting-started|Learn how to set up Lucia in your project||Starter guides|/starter-guides|Guides and examples to learn the basics of Lucia using your framework of your choice.|username-and-password-authentication:Username and password authentication\github-oauth:GitHub OAuth|Handle users with OAuth|/oauth/basics/handle-users|Learn how to use handle users with OAuth|basic-usage:Basic usage\add-a-new-key-to-an-existing-user:Add a new key to an existing user\extension:Extension\get-provider-user:Get provider user\get-api-tokens:Get API tokens|OAuth 2.0 with PKCE|/oauth/basics/oauth2-pkce|Learn how to implement OAuth 2.0 with PKCE|built-in-providers:Built-in providers\get-authorization-url:Get authorization url\validate-callback:Validate callback\oauth-helpers:OAuth helpers\create-authorization-url:Create authorization URL\additional-configuration:Additional configuration\validate-authorization-code:Validate authorization code\client-password:Client password\errors:Errors|OAuth 2.0|/oauth/basics/oauth2|Learn how to implement OAuth 2.0|built-in-providers:Built-in providers\get-authorization-url:Get authorization url\validate-callback:Validate callback\oauth-helpers:OAuth helpers\create-authorization-url:Create authorization URL\additional-configuration:Additional configuration\validate-authorization-code:Validate authorization code\client-password:Client password\errors:Errors|Open ID Connect|/oauth/basics/oidc|Learn how to implement|handle-id-token:Handle ID Token|OAuth integration|/oauth|Learn about the OAuth integration for Lucia|step-by-step-guides:Step-by-step guides\built-in-providers:Built-in providers|Apple OAuth provider|/oauth/providers/apple|Learn how to use the Apple OAuth provider|apple:apple()\import-certificate:Import certificate\requesting-scopes:Requesting scopes\interfaces:Interfaces\appleauth:AppleAuth\appletokens:AppleTokens\appleuser:AppleUser\appleuserauth:AppleUserAuth|Atlassian OAuth provider|/oauth/providers/atlassian|Learn how to use the Atlassian OAuth provider|atlassian:atlassian()\interfaces:Interfaces\atlassianauth:AtlassianAuth\atlassiantokens:AtlassianTokens\atlassianuser:AtlassianUser\atlassianuserauth:AtlassianUserAuth|Auth0 OAuth provider|/oauth/providers/auth0|Learn how to use the Auth0 OAuth provider|auth0:auth0()\interfaces:Interfaces\auth0auth:Auth0Auth\auth0tokens:Auth0Tokens\auth0user:Auth0User\auth0userauth:Auth0UserAuth|Azure Active Directory OAuth provider|/oauth/providers/azure-ad|Learn how to use the Azure Active Directory OAuth provider|azuread:azureAd()\interfaces:Interfaces\azureadauth:AzureADAuth\azureadtokens:AzureADTokens\azureaduser:AzureADUser\azureaduserauth:AzureADUserAuth|Bitbucket OAuth provider|/oauth/providers/bitbucket|Learn how to use the Bitbucket OAuth provider|bitbucket:bitbucket()\interfaces:Interfaces\bitbucketauth:BitbucketAuth\bitbuckettokens:BitbucketTokens\bitbucketuser:BitbucketUser\bitbucketuserauth:BitbucketUserAuth|Box OAuth provider|/oauth/providers/box|Learn how to use the Box OAuth provider|box:box()\interfaces:Interfaces\boxauth:BoxAuth\boxtokens:BoxTokens\boxuser:BoxUser\boxuserauth:BoxUserAuth|Amazon Cognito OAuth provider|/oauth/providers/cognito|Learn about using the Amazon Cognito provider|cognito:cognito()\interfaces:Interfaces\cognitoauth:CognitoAuth\cognitotokens:CognitoTokens\cognitouser:CognitoUser\cognitouserauth:CognitoUserAuth|Discord OAuth provider|/oauth/providers/discord|Learn how to use the Discord OAuth provider|discord:discord()\interfaces:Interfaces\discordauth:DiscordAuth\discordtokens:DiscordTokens\discorduser:DiscordUser\discorduserauth:DiscordUserAuth|Dropbox OAuth provider|/oauth/providers/dropbox|Learn how to use the Dropbox OAuth provider|dropbox:dropbox()\interfaces:Interfaces\dropboxauth:DropboxAuth\dropboxtokens:DropboxTokens\dropboxuser:DropboxUser\dropboxuserauth:DropboxUserAuth|Facebook OAuth provider|/oauth/providers/facebook|Learn how to use the Facebook OAuth provider|facebook:facebook()\interfaces:Interfaces\facebookauth:FacebookAuth\facebooktokens:FacebookTokens\facebookuser:FacebookUser\facebookuserauth:FacebookUserAuth|GitHub OAuth provider|/oauth/providers/github|Learn how to use the GitHub OAuth provider|github:github()\interfaces:Interfaces\githubauth:GithubAuth\githubtokens:GithubTokens\githubuser:GithubUser\githubuserauth:GithubUserAuth|GitLab OAuth provider|/oauth/providers/gitlab|Learn how to use the GitLab OAuth provider|gitlab:gitlab()\interfaces:Interfaces\gitlabauth:GitlabAuth\gitlabtokens:GitlabTokens\gitlabuser:GitlabUser\gitlabuserauth:GitlabUserAuth|Google OAuth provider|/oauth/providers/google|Learn how to use the Google OAuth provider|google:google()\interfaces:Interfaces\googleauth:GoogleAuth\googletokens:GoogleTokens\googleuser:GoogleUser\googleuserauth:GoogleUserAuth|Kakao OAuth provider|/oauth/providers/kakao|Learn how to use the Kakao OAuth provider|kakao:kakao()\interfaces:Interfaces\kakaoauth:KakaoAuth\kakaotokens:KakaoTokens\kakaouser:KakaoUser\kakaouserauth:KakaoUserAuth|Keycloak OAuth provider|/oauth/providers/keycloak|Learn how to use the Keycloak OAuth provider|keycloak:keycloak()\interfaces:Interfaces\keycloakauth:KeycloakAuth\keycloaktokens:KeycloakTokens\keycloakuser:KeycloakUser\keycloakrole:KeycloakRole\keycloakuserauth:KeycloakUserAuth|Lichess OAuth provider|/oauth/providers/lichess|Learn how to use the Lichess OAuth provider|lichess:lichess()\interfaces:Interfaces\lichessauth:LichessAuth\lichesstokens:LichessTokens\lichessuser:LichessUser\lichessuserauth:LichessUserAuth|Line OAuth provider|/oauth/providers/line|Learn how to use the Line OAuth provider|line:line()\interfaces:Interfaces\lineauth:LineAuth\linetokens:LineTokens\lineuser:LineUser\lineuserauth:LineUserAuth|LinkedIn OAuth provider|/oauth/providers/linkedin|Learn how to use the LinkedIn OAuth provider|linkedin:linkedIn()\interfaces:Interfaces\linkedinauth:LinkedInAuth\linkedintokens:LinkedInTokens\linkedinuser:LinkedInUser\linkedinuserauth:LinkedInUserAuth|osu! OAuth provider|/oauth/providers/osu|Learn how to use the osu! OAuth provider|osu:osu()\interfaces:Interfaces\osuauth:OsuAuth\osutokens:OsuTokens\osuuser:OsuUser\osuuserauth:OsuUserAuth|Patreon OAuth provider|/oauth/providers/patreon|Learn how to use the Patreon OAuth provider|patreon:patreon()\interfaces:Interfaces\patreonauth:PatreonAuth\patreontokens:PatreonTokens\patreonuser:PatreonUser\patreonuserauth:PatreonUserAuth|Reddit OAuth provider|/oauth/providers/reddit|Learn how to use the Reddit OAuth provider|reddit:reddit()\interfaces:Interfaces\redditauth:RedditAuth\reddittokens:RedditTokens\reddituser:RedditUser\reddituserauth:RedditUserAuth|Salesforce OAuth provider|/oauth/providers/salesforce|Learn how to use the Salesforce OAuth provider|salesforce:salesforce()\interfaces:Interfaces\salesforceauth:SalesforceAuth\salesforcetokens:SalesforceTokens\salesforceuser:SalesforceUser\salesforceuserauth:SalesforceUserAuth|Slack OAuth provider|/oauth/providers/slack|Learn how to use the Salck OAuth provider|slack:slack()\interfaces:Interfaces\slackauth:SlackAuth\slacktokens:SlackTokens\slackuser:SlackUser\slackuserauth:SlackUserAuth|Spotify OAuth provider|/oauth/providers/spotify|Learn how to use the Spotify OAuth provider|spotify:spotify()\interfaces:Interfaces\spotifyauth:SpotifyAuth\spotifytokens:SpotifyTokens\spotifyuser:SpotifyUser\spotifyuserauth:SpotifyUserAuth|Strava OAuth provider|/oauth/providers/strava|Learn how to use the Strava OAuth provider|strava:strava()\interfaces:Interfaces\stravaauth:StravaAuth\stravatokens:StravaTokens\stravauser:StravaUser\stravauserauth:StravaUserAuth|Twitch OAuth provider|/oauth/providers/twitch|Learn how to use the Twitch OAuth provider|twitch:twitch()\interfaces:Interfaces\twitchauth:TwitchAuth\twitchtokens:TwitchTokens\twitchuser:TwitchUser\twitchuserauth:TwitchUserAuth|Twitter OAuth provider|/oauth/providers/twitter|Learn how to use the Twitter OAuth provider|twitter:twitter()\interfaces:Interfaces\twitterauth:TwitterAuth\twittertokens:TwitterTokens\twitteruser:TwitterUser\twitteruserauth:TwitterUserAuth|Database adapters API|/reference/database-adapter|Learn how to build your own database adapters|errors:Errors\initializeadapter:InitializeAdapter\adapter:Adapter\getsessionanduser:getSessionAndUser()\useradapter:UserAdapter\deletekey:deleteKey()\deletekeysbyuserid:deleteKeysByUserId()\deleteuser:deleteUser()\getkey:getKey()\getkeysbyuserid:getKeysByUserId()\getuser:getUser()\setkey:setKey()\setuser:setUser()\updatekey:updateKey()\updateuser:updateUser()\sessionadapter:SessionAdapter\deletesession:deleteSession()\deletesessionsbyuserid:deleteSessionsByUserId()\getsession:getSession()\getsessionsbyuserid:getSessionsByUserId()\setsession:setSession()\updatesession:updateSession()|Reference overview|/reference||lucia:lucia\lucia-authoauth:@lucia-auth/oauth\adapters:Adapters\lucia-authadapter-mongoose:@lucia-auth/adapter-mongoose\lucia-authadapter-mysql:@lucia-auth/adapter-mysql\lucia-authadapter-postgresql:@lucia-auth/adapter-postgresql\lucia-authadapter-prisma:@lucia-auth/adapter-prisma\lucia-authadapter-sqlite:@lucia-auth/adapter-sqlite\lucia-authadapter-session-redis:@lucia-auth/adapter-session-redis\lucia-authadapter-session-unstorage:@lucia-auth/adapter-session-unstorage|Auth|/reference/lucia/interfaces/auth||createkey:createKey()\createsession:createSession()\createsessioncookie:createSessionCookie()\createuser:createUser()\deletedeadusersessions:deleteDeadUserSessions()\deletekey:deleteKey()\deleteuser:deleteUser()\getalluserkeys:getAllUserKeys()\getallusersessions:getAllUserSessions()\getkey:getKey()\getsession:getSession()\getuser:getUser()\handlerequest:handleRequest()\invalidateallusersessions:invalidateAllUserSessions()\invalidatesession:invalidateSession()\readbearertoken:readBearerToken()\readsessioncookie:readSessionCookie()\transformdatabasekey:transformDatabaseKey()\transformdatabasesession:transformDatabaseSession()\transformdatabaseuser:transformDatabaseUser()\updatekeypassword:updateKeyPassword()\updatesessionattributes:updateSessionAttributes()\updateuserattributes:updateUserAttributes()\usekey:useKey()\validaterequestorigin:validateRequestOrigin()\validatesession:validateSession()|AuthRequest|/reference/lucia/interfaces/authrequest||invalidate:invalidate()\setsession:setSession()\validate:validate()\validatebearertoken:validateBearerToken()|Interfaces|/reference/lucia/interfaces||adapter:Adapter\auth:Auth\authrequest:AuthRequest\configuration:Configuration\cookie:Cookie\serialize:serialize()\env:Env\initializeadapter:InitializeAdapter\key:Key\keyschema:KeySchema\luciaerrorconstructor:LuciaErrorConstructor\luciarequest:LuciaRequest\middleware:Middleware\requestcontext:RequestContext\session:Session\sessionadapter:SessionAdapter\sessionschema:SessionSchema\user:User\useradapter:UserAdapter\userschema:UserSchema|lucia|/reference/lucia/modules/main||createkeyid:createKeyId()\default_session_cookie_name:DEFAULT_SESSION_COOKIE_NAME\lucia:lucia()\luciaerror:LuciaError()|lucia/middleware|/reference/lucia/modules/middleware||astro:astro()\elysia:elysia()\express:express()\fastify:fastify()\h3:h3()\hono:hono()\lucia:lucia()\nextjs:nextjs()\nextjs_future:nextjs_future()\node:node()\sveltekit:sveltekit()\web:web()\qwik:qwik()\elysia-1:elysia()|lucia/polyfill/node|/reference/lucia/modules/polyfill/node|||lucia/utils|/reference/lucia/modules/utils||generateluciapasswordhash:generateLuciaPasswordHash()\generaterandomstring:generateRandomString()\iswithinexpiration:isWithinExpiration()\joinadapters:joinAdapters()\parsecookie:parseCookie()\serializecookie:serializeCookie()\validateluciapasswordhash:validateLuciaPasswordHash()|Middleware API|/reference/middleware|Learn how to implement your own middleware|middleware:Middleware\requestcontext:RequestContext\typing-middleware:Typing Middleware|Interfaces|/reference/oauth/interfaces||oauth2providerauth:OAuth2ProviderAuth\oauth2providerauthwithpkce:OAuth2ProviderAuthWithPKCE\oauthrequesterror:OAuthRequestError\provideruserauth:ProviderUserAuth|OAuth2ProviderAuth|/reference/oauth/interfaces/oauth2providerauth||getauthorizationurl:getAuthorizationUrl()\validatecallback:validateCallback()|OAuth2ProviderAuthWithPKCE|/reference/oauth/interfaces/oauth2providerauthwithpkce||getauthorizationurl:getAuthorizationUrl()\validatecallback:validateCallback()|ProviderUserAuth|/reference/oauth/interfaces/provideruserauth||createkey:createKey()\createuser:createUser()\getexistinguser:getExistingUser()|@lucia-auth/oauth|/reference/oauth/modules/main||createoauth2authorizationurl:createOAuth2AuthorizationUrl()\createoauth2authorizationurlwithpkce:createOAuth2AuthorizationUrlWithPKCE()\decodeidtoken:decodeIdToken()\oauthrequesterror:OAuthRequestError\provideruserauth:providerUserAuth()\validateoauth2authorizationcode:validateOAuth2AuthorizationCode()|@lucia-auth/oauth/providers|/reference/oauth/modules/providers||apple:apple()\atlassian:atlassian()\auth0:auth0()\azuread:azureAD()\bitbucket:bitbucket()\box:box()\discord:discord()\dropbox:dropbox()\facebook:facebook()\github:github()\gitlab:gitlab()\google:google()\kakao:kakao()\keycloak:keycloak()\lichess:lichess()\line:line()\linkedin:linkedIn()\osu:osu()\patreon:patreon()\reddit:reddit()\salesforce:salesforce()\slack:slack()\spotify:spotify()\strava:strava()\twitch:twitch()\twitter:twitter()