Back to articles
Directus Auth out of the Box — Registration, Login, Email Verification and Password Reset

Directus Auth out of the Box — Registration, Login, Email Verification and Password Reset

via Dev.to WebdevWade Thomas

One of the things I appreciate most about Directus is that authentication is built in. Registration, login, email verification, and password reset — all handled without reaching for a third party auth service like Auth0 or Clerk. Here's how I implement the full auth flow in a TanStack Start app using the Directus SDK. User Registration The SDK's registerUser function handles registration. You pass the email, password and any additional fields. The verification_url tells Directus where to redirect the user after they click the link in their email — Directus appends the token to that URL automatically. export async function registerUser ( email : string , password : string , firstName : string , lastName : string , ) { const options = { first_name : firstName , last_name : lastName , verification_url : ` ${ import . meta . env . VITE_TANSTACK_URL } /auth/verify-email` , }; return await directus . request ( registerUserDirectus ( email , password , options ), ); } Directus sends the verif

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
6 views

Related Articles