Authentication
ShipAny currently supports three login methods: Google Login / Google One-Tap Login / Github Login.
Other login methods will be integrated gradually. You can also refer to the next-auth documentation to implement them yourself.
Generate Auth Secret
Run in terminal:
openssl rand -base64 32This generates a 32-byte random string to use as Auth Secret
Modify the AUTH_SECRET value in your environment variables:
AUTH_SECRET = "xxx"Google Login
- Sign in to Google Cloud Console
Create a new project, go to the Credentials management page of the new project, and create an OAuth Client ID

- Configure the necessary callback information according to your project’s port and production domain
- Local development configuration
http://localhost:3000/api/auth/callback/google- Production configuration
https://{your-domain}/api/auth/callback/google
After creating the OAuth Client ID, you’ll receive a Client ID and Client Secret
- Modify
AUTH_GOOGLE_IDandAUTH_GOOGLE_SECRETin your configuration file
Enable Google login:
AUTH_GOOGLE_ID = "4680xx-xxx.apps.googleusercontent.com"
AUTH_GOOGLE_SECRET = "GOxxx"
NEXT_PUBLIC_AUTH_GOOGLE_ENABLED = "true"Google One-Tap Login
First, follow the Google login steps to obtain AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET
Modify NEXT_PUBLIC_AUTH_GOOGLE_ONE_TAP_ENABLED and NEXT_PUBLIC_AUTH_GOOGLE_ID in your configuration file
Enable Google One-Tap login:
NEXT_PUBLIC_AUTH_GOOGLE_ONE_TAP_ENABLED = "true"
NEXT_PUBLIC_AUTH_GOOGLE_ID = "4680xx-xxx.apps.googleusercontent.com"The
NEXT_PUBLIC_AUTH_GOOGLE_IDused for Google One-Tap login should be the same as theAUTH_GOOGLE_IDconfigured for Google login.
Github Login
Create a new OAuth app
- Fill in the OAuth app configuration information
http://localhost:3000/api/auth/callback/github
For development and production environments, you need to create two different OAuth apps with different callback URLs.
-
Enter the OAuth app, copy the
Client IDandClient Secret -
Modify
AUTH_GITHUB_IDandAUTH_GITHUB_SECRETin your configuration file
Enable Github login:
AUTH_GITHUB_ID = "xxx"
AUTH_GITHUB_SECRET = "xxx"
NEXT_PUBLIC_AUTH_GITHUB_ENABLED = "true"Login Preview
- Click the login button to open the login popup

- When users enter the homepage, they’ll be prompted with one-tap login
