Google Login
Your application supports Google OAuth for user authentication. Follow the steps below to configure it for development and production environments.
Setup Instructions
1. Add Environment Variables
Ensure the following values are added to your .env file for the development environment:
Replace placeholders with the credentials from Google Cloud.
2. Create a Google Cloud Project
-
Go to the Google Cloud Console.
-
Navigate to APIs & Services → Credentials.
-
Click Configure Consent Screen:
- Select External.
- Add your contact email and agree to the terms.
- Fill in the required app details, including the scopes
userinfo.emailanduserinfo.profile. - Save the changes.
-
Under Credentials, click + Create Credentials → OAuth Client ID:
- Choose Web Application.
- Add
http://localhost:3000andhttps://your-site.comto Authorized JavaScript origins. - Add the following URIs to Authorized redirect URIs:
-
http://localhost:3000/auth/google/redirect -
http://localhost:3000/auth/google/redirect/ -
https://your-site.com/auth/google/redirect
-
Note: Include subdomains if applicable.
-
Click Create and copy the Client ID and Client Secret.
3. Finalize OAuth Consent Screen
- Go to OAuth Consent Screen.
- Click Publish App and complete the submission for verification.
- Google will require domain verification via Google Search Console.
- Add and verify your domain.
You can now use Google login on localhost. Production login will work but may display a warning until verification is complete.
Notes
- Ensure the
.envfile is configured correctly for production. - Verification may take a few days, but the app will function in the interim.
Ready to deploy? Refer to the deployment guide for detailed instructions on setting up your app on the cloud.