Skip to content
Back

Handling Multiple OAuth Providers with the Same Email

  • 0
  • Auth
Saimon
10 Sep, 2025, 03:36

In my project, I am using both Google and GitHub as OAuth providers. Suppose a user signs up using the Google provider, and later tries to sign in using the GitHub provider with the same email address.

  1. Does Appwrite automatically merge these accounts?
  2. Or does it create two separate accounts for the same email?
  3. If merging is possible, how does Appwrite handle the provider UID and existing session data?
TL;DR
Solution: The Appwrite does not automatically merge accounts for the same email address when using different OAuth providers. It will create two separate accounts. If merging is necessary, the developer will need to handle the provider UID and existing session data manually.
Steven
10 Sep, 2025, 16:23
  1. Yes
  2. No
  3. the provider UID is stored in the new session and identity.

Maybe this will also give you more info: https://appwrite.io/docs/products/auth/identities

Saimon
10 Sep, 2025, 16:42
TypeScript
const session = await account.createSession({ userId, secret });
console.log("session", session);

output :

TypeScript
    "$id": "68c1a980e5b89dddecc4",
    "$createdAt": "2025-09-10T16:38:25.326+00:00",
    "$updatedAt": "2025-09-10T16:38:25.326+00:00",
    "userId": "68c184f10009322ad7f5",
    "expire": "2026-09-10T16:38:25.518+00:00",
    "provider": "oauth2",
    "providerUid": "",
    "providerAccessToken": "",
    "providerAccessTokenExpiry": "",
    "providerRefreshToken": "",
    "ip": "172.20.0.1",
    "osCode": "WIN",
    "osName": "Windows",
    "osVersion": "10",
    "clientType": "browser",
    "clientCode": "CH",
    "clientName": "Chrome",
    "clientVersion": "140.0",
    "clientEngine": "Blink",
    "clientEngineVersion": "140.0.0.0",
    "deviceName": "desktop",
    "deviceBrand": "",
    "deviceModel": "",
    "countryCode": "--",
    "countryName": "Unknown",
    "current": true,
    "factors": [
        "email"
    ],
    "secret": "",
    "mfaUpdatedAt": ""
}```

here  `providerUid` is blank.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more