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
- Install dependencies
bun install
- 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.
- Start the Development Server
bun dev
- Open the local server and click Sign In. After signing in with Google, you will be redirected to /dashboard and see your email.
MIT