Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 1.55 KB

README.md

File metadata and controls

43 lines (27 loc) · 1.55 KB

Next.js + Auth.js Authentication Template

This next.js project provides a foundational setup for integrating auth.js into your application to enable authentication functionalities and streamline your project development. Auth.js supports various authentication methods with numerous mainstream providers, simplifying the integration process when multiple methods are required.

The demo showcases:

  • The basic sign-in/sign-out flow
  • Restricted user access ref
  • Accessing session data
  • Customizing the default theme for the sign-in page

Getting Started

  1. Install dependencies
bun install
  1. Set Up Environment Variables
cp .env.local.example .env.local
  • BASE_URL (optional) - Used for sign-in success redirection. Adjust this based on your domain setup. It is not mandatory for integrating auth.js.

  • AUTH_SECRET (required) - Generate a secure key using openssl rand -base64 33 or any other secure method.

  • AUTH_GOOGLE_* (optional) - Refer to the Google OAuth 2.0 documentation to obtain credentials for Google OAuth 2.0. For detailed instructions, check the Auth.js guide.

  1. Start the Development Server
bun dev
  1. Open the local server and click Sign In. After signing in with Google, you will be redirected to /dashboard and see your email.

License

MIT