> For the complete documentation index, see [llms.txt](https://docs.uibakery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uibakery.io/on-premise/sso/openid/google-oauth2.md).

# Google OAuth2

Connect your Google

## Create new Credentials in the Google Cloud Console

To set up Google authentication for UI Bakery, follow these steps:

1. Go to [Google Cloud Console](https://console.cloud.google.com/) and create new credentials for **OAuth Client ID;**
2. Select **Web Application** as the Application type;
3. Optionally, add your instance address in **Authorized JavaScript Origins'**
4. Add **Authorized Redirect URIs** with the value `https://YOUR_INSTANCE/auth/oauth2/callback`
5. Click Save and copy **Client ID.**

## Update UI Bakery environment variables

For Google authorization, you have two options for configuration.

### **Option 1 (Recommended):**

Use a single variable configuration:

```
UI_BAKERY_GOOGLE_CLIENT_ID=<your-client-id>
```

### **Option 2 (Classic OAuth Integration):**

Alternatively, you can set up Google SSO as a classic OAuth integration with the following variables:

```
UI_BAKERY_OAUTH_CLIENT_ID=<your-client-id>
UI_BAKERY_OAUTH_CLIENT_SECRET=<your-client-secret>
UI_BAKERY_OAUTH_SCOPE=profile email
UI_BAKERY_OAUTH_AUTH_URL=https://accounts.google.com/o/oauth2/v2/auth
UI_BAKERY_OAUTH_TOKEN_URL=https://oauth2.googleapis.com/token
UI_BAKERY_OAUTH_USERINFO_URL=https://openidconnect.googleapis.com/v1/userinfo
UI_BAKERY_BRANDING_AUTH_SSO_BTN_TEXT=Login with Google
```

{% hint style="info" %}
Please note that syncing roles with Google OAuth is not supported. To achieve this, you'll need to set up Google SAML App for role synchronization.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uibakery.io/on-premise/sso/openid/google-oauth2.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
