Created this customizable template for implementing GitHub OAuth authentication in Next.js. Just to avoid the complexity of next-auth
- Next.js v15 + TypeScript
- Direct GitHub OAuth implementation
- Custom Session Management
-
Clone the repo
-
Install the modules
pnpm install
- Set the environment variables in the .env file
-
Go to GitHub Developer Settings > OAuth Apps > New OAuth App
-
Fill in the application details:
- Application name: Your app name
- Homepage URL: http://localhost:3000
- Authorization callback URL: http://localhost:3000/api/auth/callback/github
-
Copy the generated Client ID and Client Secret to your .env.local file
Contributions are welcome!