DevRocket
Features

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:

GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/redirect

Replace placeholders with the credentials from Google Cloud.


2. Create a Google Cloud Project

  1. Go to the Google Cloud Console.

  2. Navigate to APIs & ServicesCredentials.

  3. 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.email and userinfo.profile.
    • Save the changes.
  4. Under Credentials, click + Create CredentialsOAuth Client ID:

    • Choose Web Application.
    • Add http://localhost:3000 and https://your-site.com to 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.

  5. Click Create and copy the Client ID and Client Secret.


  1. Go to OAuth Consent Screen.
  2. Click Publish App and complete the submission for verification.
  3. 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 .env file 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.

On this page