# Google oAuth2

### **Setup**

To create an OAuth 2.0 client ID in the Google Cloud Platform Console:

1. **Go to the Google Cloud Platform Console**.
2. From the projects list, **select a project** or create a new one.
3. Navigate to **API & Services > Credentials**.
4. **Configure your OAuth consent screen**:
   * Set up the app name, support email, and your app’s domain, if applicable.
5. **Create OAuth Credentials**:
   * Click **New Credentials** and select **OAuth client ID**.
   * Choose **Web application** as the application type.
   * Add your application’s **Authorized Redirect URIs** (e.g., `https://yourapp.com/auth/callback` for production, or `http://localhost:3000/auth/callback` for local development).
6. After creation, you’ll receive a **Client ID** and **Client Secret**. Copy these for use in both your front-end and backend configurations.

To **delete a client ID**, go to the **Credentials** page, check the box next to the ID, and click **Delete**.

7. **Configure API Passport Strategy**:

* Use the received **Client ID** and **Client Secret**.
* Follow the [OAuth Providers documentation](/intercode-saas-kit/pages/auth/oauth-providers.md) for additional implementation details.

***

### Publishing Your Application

Publishing your application will allow you to authenticate any Google user, enabling the use of your credentials in a production environment.

1. **Set Up OAuth Consent Screen for Production**:
   * In the OAuth consent screen settings, add production details such as the official app name, support email, and privacy policy URL.
2. **Testing the Production Environment**:
   * After deployment, thoroughly test your OAuth setup on the live site to ensure all flows (login, redirect, logout) work smoothly and securely.
   * Verify tokens are handled correctly and that your OAuth implementation behaves as expected.
3. **Monitor OAuth Usage**:
   * In the Google Cloud Console, go to **API & Services > Credentials** to monitor usage, track traffic, and troubleshoot any potential issues.
4. **Communicate OAuth Status to Users**:
   * On the login screen, inform users that they can securely log in with Google, and provide a link to your privacy policy to establish user trust.

***

**Verification Note**

Currently, no verification is required for basic scopes (e.g., `email` and `profile`). However, requesting additional scopes in the future, particularly for sensitive or restricted data, may prompt Google to require app verification. This process involves submitting your app for review to ensure it complies with Google’s data policies.

***

{% content-ref url="/pages/soFCx6B0p2jgssJ1vlxE" %}
[Working with PassportJS](/intercode-saas-kit/pages/auth/working-with-passportjs.md)
{% endcontent-ref %}

{% content-ref url="/pages/819NltTQLCVSCepklHIa" %}
[OAuth Providers](/intercode-saas-kit/pages/auth/oauth-providers.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://intercode.gitbook.io/intercode-saas-kit/external-integrations/google-oauth2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
