Login
Docs
User Authentication

User Authentication

ZexaNext uses Auth.js for user authentication. Auth.js previously NextAuth is a complete open-source authentication solution for Next.js applications.

You can configure it in the app/api/auth/[...nextauth]/route.ts file.

Add the following env variables to your .env file:

AUTH_SECRET=CqWEFAUU5mKK5FgmKCoWTDgLepmtaHzaJvcsMndtKLY=
NEXT_PUBLIC_APP_URL=http://localhost:3000

ZexaNext provides 3 built-in authentication providers: Google, Github and Email.

Login and Registration

Once you have configured the authentication provider, you use /auth/login page for login and /auth/register page for user registration. You can edit the default login redirect in config/route.ts file.

export const DEFAULT_LOGIN_REDIRECT = '/dashboard'

Generally you would want to redirect the user to the dashboard page after login.

Forgot Password

We have also provided a forgot password option in the login page which sends an email to the user with a link to reset the password. You can check forgot password page at /auth/reset.