LucidAuth
Providers

Google OAuth

Implementing Google OAuth with LucidAuth

Obtaining Google OAuth 2.0 Credentials

Follow the steps below to create a project in the Google Cloud console and obtain OAuth 2.0 credentials, which authenticate your application to Google’s OAuth 2.0 server.

Create a Project

  1. Go to the Google Cloud Console.
  2. On the main navigation bar at the top, to the left of the search box, you’ll see the project selector. Click it to open a dialog listing all your projects. In the dialog click New project.
  3. Enter a project name and click Create. Once the project is created, click Select project. The project’s name should appear in the project selector.
  4. Next, click the hamburger menu on the top-left corner of the page to open the sidebar navigation, then navigate to APIs & services > OAuth consent screen.
  1. On the OAuth overview page, click Get started.
  2. Under App information, enter your app name and user support email, then click Next.
  3. Select External as the audience type (This setting makes your project accessible to anyone with a Google account.), then click Next.
  4. Under Contact Information, enter your email address, then click Next.
  5. Select the checkbox labeled I agree to the Google API services user data policy, then click Continue.
  6. Click Create.
  7. You should see a toast notification with the message OAuth configuration created.

OAuth credentials

  1. Click the hamburger menu in the top-left corner of the page to open the sidebar navigation, then navigate to APIs & services > Credentials.

  2. On the Credentials page, click +Create credentials to open the dropdown menu. Click OAuth client ID.

  3. Select Web application as the application type. Then, enter a name for your OAuth 2.0 client in the Name field. (This name is used only to identify the client in the console and is not shown to end users.)

  4. Under Authorized JavaScript origins, click Add URI and enter http://localhost:3000. This URI is the HTTP origin that hosts your web application. Note: When you deploy your app to production, you will need to come back here and add your live domain, e.g., https://your-domain.com.

  5. Under Authorized redirect URIs, enter http://localhost:3000/api/auth/callback/google. This URI is the endpoint in your application where the Google OAuth server will send responses to your authentication requests. Note: When you deploy your app to production, you will need to come back here and add your live callback URL, e.g., https://your-domain.com/api/auth/callback/google.

    Note

    The authorized redirect URI must exactly match http://localhost:3000/api/auth/callback/google. LucidAuth requires this specific endpoint to verify and process the authorization code sent from the Google authorization server.

  6. Click Create.

  7. After the OAuth client is created, a dialog appears with the title OAuth client created. In the dialog you’ll see both the Client ID and Client secret details. Copy both and store them securely; you'll need these credentials in the next section when setting up environment variables.

On this page