Logo
RavenSaaS Docs

Authentication

Authentication Overview

RavenSaaS currently supports Google Login / Google One Tap / Github Login three login methods.

Other login methods are gradually integrated, you can also refer to next-auth documentation for self-integration.

Google Login

Supports traditional Google OAuth login process, secure and reliable.

Google One Tap

Google One Tap login provides a more convenient user experience.

Github Login

Github OAuth login integration for developers.

Generate Auth Secret

Run the following command in terminal to generate a 32-byte random string as Auth Secret:

Terminal
1openssl rand -base64 32

Modify the AUTH_SECRET value in environment variables:

.env.development
1NEXTAUTH_SECRET = "xxx"

Google Login

1. Create OAuth Client ID

Login to Google Cloud Console, create a new project, enter the Credentials management page of the new project, and create OAuth Client ID.

Google Console

2. Configure Callback Address

Configure necessary callback information according to your project's running port and online domain:

Local Debug Configuration

callbackUrl
1http://localhost:3000/api/auth/callback/google

Production Configuration

callbackUrl
1https://{your-domain}/api/auth/callback/google
Google Client ID

3. Configure Environment Variables

After creating OAuth Client ID, get Client ID and Client Secret, modify related variables in configuration file:

.env.development
1AUTH_GOOGLE_ID = "5292xxx-xxx.apps.googleusercontent.com"
2AUTH_GOOGLE_SECRET = "GOxxx"
3
4NEXT_PUBLIC_AUTH_GOOGLE_ENABLED = "true"

Google One Tap

First follow the Google login steps to get AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET.

Enable Google One Tap

Modify related variables in configuration file:

.env.development
1NEXT_PUBLIC_AUTH_GOOGLE_ONE_TAP_ENABLED = "true"
2NEXT_PUBLIC_AUTH_GOOGLE_ID = "5292xxx-xxx.apps.googleusercontent.com"

The NEXT_PUBLIC_AUTH_GOOGLE_ID used by Google One Tap should be consistent with AUTH_GOOGLE_ID configured for Google login.

Github Login

1. Create OAuth App

Go to Github Developer Settings and create a new OAuth app.

2. Fill OAuth App Configuration Information

Configure callback address:

callbackUrl
1http://localhost:3000/api/auth/callback/github
Github Callback

Development and production environments need to create two different OAuth apps with different callback addresses configured respectively.

3. Configure Environment Variables

Enter OAuth app, copy Client ID and Client Secret, modify configuration file:

.env.development
1AUTH_GITHUB_ID = "xxx"
2AUTH_GITHUB_SECRET = "xxx"
3NEXT_PUBLIC_AUTH_GITHUB_ENABLED = "true"

Login Preview

1. Jump to Login

Click login button to jump to login page:

Login Preview

2. One Tap Login Prompt

User enters homepage, prompts one tap login:

Google One Tap

Reference

NextAuth.js

NextAuth.js official documentation

View Docs

Github Oauth

Github Oauth 配置文档

View Docs

Last updated on January 5, 2025