> For the complete documentation index, see [llms.txt](https://help.twinr.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.twinr.dev/extensions/google-sign-in.md).

# Google Sign In

## <mark style="color:green;">Overview</mark>

Allow users to securely sign in to your app using their Google account. Google Sign-In provides a fast and trusted authentication experience without requiring users to create a separate account.

***

## <mark style="color:green;">Configure Google Sign-In</mark>

To enable Google Sign-In in your app:

1. Open your **Twinr Builder**.
2. Navigate to **Extensions**.
3. Click **Google Sign-In**.
4. Turn on the **Enable Google Sign-In** toggle.

Once enabled, you can configure how Google authentication works in your application.

***

### <mark style="color:green;">Step 1: Choose how to send the Google token</mark>

Under **Send token via**, choose one of the following options:

#### Webhook (POST JSON)

Select this option if you want Google authentication tokens to be sent directly to your backend server using a **POST** request.

This is the recommended option when your backend verifies Google users before allowing them to log in.

#### URL Redirect (Query Parameters)

Select this option if you want users to be redirected to your authentication URL after signing in.

The Google authentication data will be passed as URL query parameters.

This option is commonly used for web-based authentication flows.

### <mark style="color:green;">Step 2: Enter your Auth Callback URL</mark>

Provide the URL that will receive the Google authentication response.

Example:

```
https://your-domain.com/auth/google
```

> **Tip:** Always use a secure HTTPS URL.

***

### <mark style="color:green;">Step 3: Enter your Google OAuth Client IDs</mark>

Google Sign-In requires OAuth credentials created in the **Google Cloud Console**.

Fill in the following fields:

#### Web Client ID (Optional)

Used for backend token verification.

Although optional, it is recommended for improved security.

Example:

```
1234567890-xxxxxxxx.apps.googleusercontent.com
```

***

#### iOS Client ID

Enter the OAuth Client ID created for your iOS application.

Example:

```
123456.apps.googleusercontent.com
```

***

#### Android Client ID

Enter the OAuth Client ID created for your Android application.

Example:

```
987654.apps.googleusercontent.com
```

***

### <mark style="color:green;">Step 4: Configure Google Cloud Console</mark>

Twinr provides your application's identifiers to simplify the Google Cloud configuration.

You'll find:

* **iOS Bundle ID**
* **Android Package Name**

Use these values while creating your OAuth Client IDs in **Google Cloud Console**.

You can click the **Copy** icon beside each value to copy it instantly.

***

### <mark style="color:green;">Step 5: Save your configuration</mark>

After completing all required fields:

1. Review your configuration.
2. Click **Save As Draft**.
3. Publish a new version of your application.

Google Sign-In will now be included in your latest app version.

***

## <mark style="color:green;">How It Works</mark>

When a user taps the **Continue with Google** button inside your app:

1. Google displays the account selection screen.
2. The user selects a Google account.
3. Google authenticates the user.
4. Twinr receives the authentication token.
5. Depending on your selected configuration:
   * The token is sent to your backend using **Webhook (POST JSON)**, or
   * The user is redirected to your **Auth Callback URL** with the authentication data.
6. After successful verification, the user is logged into the application.

***

## <mark style="color:green;">Use Case Examples</mark>

#### E-commerce App

Allow customers to log in instantly using their Google account instead of creating a new account.

***

#### Community App

Members can securely access their profiles with a single tap using Google authentication.

***

#### Business Portal

Employees can authenticate using their Google Workspace accounts for quick and secure access.

***

#### Event Application

Attendees can sign in with Google to access tickets, schedules, and event updates without registration.

***

## <mark style="color:green;">Best Practices</mark>

* Always use **HTTPS** for your callback URL.
* Verify Google tokens on your backend whenever possible.
* Keep your Google OAuth Client IDs secure.
* Publish a new app version after updating the configuration.
* Test the integration on both Android and iOS devices before releasing your app.

***

## <mark style="color:green;">📱 How It Looks</mark>

After the feature is configured and your app is published:

* A **Continue with Google** button appears on your app's login screen.
* Users can select their Google account.
* Authentication completes securely through Google.
* Users are automatically signed in and redirected to your application.

***

### Troubleshooting

| Issue                                 | Possible Solution                                                                                                            |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Google Sign-In button is not visible  | Verify that Google Sign-In is enabled and the latest app version has been published.                                         |
| Authentication fails                  | Check your OAuth Client IDs and ensure they match your Google Cloud Console configuration.                                   |
| Callback URL is not working           | Verify that the URL is valid, publicly accessible, and uses HTTPS.                                                           |
| Users are redirected incorrectly      | Confirm that the correct **Send token via** option (Webhook or URL Redirect) is selected.                                    |
| Google account picker does not appear | Ensure Google Play Services (Android) or the Google Sign-In framework (iOS) is available and the device has internet access. |

This structure matches the style of your existing Twinr help documentation while providing clear, step-by-step guidance for end users.
