> ## Documentation Index
> Fetch the complete documentation index at: https://docs.startmyvpn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Social Login

> Enable Google OAuth login for your users.

StartMyVPN supports Google OAuth as an optional login method. When enabled, users can sign in with their Google account instead of a password.

## Setting up Google OAuth

### 1. Create a Google Cloud project

1. Go to [console.cloud.google.com](https://console.cloud.google.com)
2. Create a new project or select an existing one
3. Navigate to **APIs & Services → Credentials**
4. Click **Create Credentials → OAuth client ID**
5. Set application type to **Web application**
6. Add the following to **Authorized redirect URIs**:
   ```
   https://yourdomain.com/auth/google/callback
   ```
7. Copy the **Client ID** and **Client Secret**

### 2. Configure in StartMyVPN

Navigate to **Admin → Settings → Social** and enter:

| Field                | Value                                         |
| -------------------- | --------------------------------------------- |
| Google Client ID     | From Google Cloud Console                     |
| Google Client Secret | From Google Cloud Console                     |
| Redirect URI         | `https://yourdomain.com/auth/google/callback` |
| Enable Google Login  | Toggle on                                     |

Or set in `.env`:

```ini theme={null}
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=https://yourdomain.com/auth/google/callback
```

## How it works

* A **Sign in with Google** button appears on the login and registration pages when enabled
* If a user signs in with Google and no account exists with that email, a new account is created automatically
* If an account already exists with the same email, the Google account is linked to it
* Email verification is skipped for Google-authenticated accounts

## Disabling Google login

Toggle **Enable Google Login** to off in **Admin → Settings → Social**. The sign-in button will be removed from public pages immediately.
