# Snapie Auth Handoff: Google OAuth `redirect_uri_mismatch`

Last updated: 2026-07-20

## Summary

The Pechi licensing activation page now sends the correct Snapie login request, but the flow is currently blocked inside Google OAuth with:

```text
Error 400: redirect_uri_mismatch
Access blocked: This app's request is invalid
```

This is a Snapie Auth / Google OAuth client configuration issue. It is not caused by the Pechi licensing page at `licensing.menosoft.xyz`.

## What is working now

The Pechi activation page opens Snapie with the required top-level parameters:

```text
https://auth.snapie.io/login?redirect=<encoded licensing callback>&plugin=pechi_saturator&machine=<16-char-machine-id>
```

Example expected URL:

```text
https://auth.snapie.io/login?redirect=https%3A%2F%2Flicensing.menosoft.xyz%2Factivate%2F%3Fplugin%3Dpechi_saturator%26machine%3D8cfc3265469a7a50&plugin=pechi_saturator&machine=8cfc3265469a7a50
```

A direct request to Snapie with that full URL returns the Snapie login page successfully. This confirms the previous `This sign-in link is missing required parameters.` problem is resolved on the Pechi side.

## Remaining failure

After clicking **Continue with Google** on Snapie, Google rejects the OAuth request with:

```text
Error 400: redirect_uri_mismatch
```

This means the Google OAuth client used by Snapie does not have the exact redirect URI registered in Google Cloud.

## Redirect URI Snapie is using

The Snapie login page builds the Google OAuth URL with this redirect URI:

```text
https://auth.snapie.io/login-callback.html
```

This comes from the Snapie login page code:

```js
redirect_uri: window.location.origin + '/login-callback.html'
```

Since the page is served from:

```text
https://auth.snapie.io/login
```

Google receives:

```text
https://auth.snapie.io/login-callback.html
```

## Required fix

In the Google Cloud project that owns the Snapie OAuth client, add this exact URI to the OAuth client's **Authorized redirect URIs**:

```text
https://auth.snapie.io/login-callback.html
```

Path in Google Cloud Console:

```text
Google Cloud Console
APIs & Services
Credentials
OAuth 2.0 Client IDs
<the Snapie web client>
Authorized redirect URIs
```

Save the OAuth client after adding the URI.

## Important details

The URI must match exactly, including:

- protocol: `https`
- host: `auth.snapie.io`
- path: `/login-callback.html`
- no trailing slash

If Snapie has separate production/staging OAuth clients, this needs to be added to the production client used by `auth.snapie.io`.

## How to retest

After updating Google Cloud, retry this Pechi activation URL:

```text
https://licensing.menosoft.xyz/activate/?plugin=pechi_saturator&machine=8cfc3265469a7a50
```

Click **Continue with Google / Apple**, then continue through Snapie Google sign-in.

Expected behavior:

1. Snapie accepts the login request.
2. Google sign-in opens without `redirect_uri_mismatch`.
3. Snapie completes auth and broadcasts the Pechi license activation.
4. Snapie redirects back to `licensing.menosoft.xyz` with:

```text
status=activated&hive_user=<username>
```

5. The Pechi activation page shows **Activated!** with the returned Hive username.
