Back

OAuth Identity should not be unique

  • 0
  • Auth
  • Web
  • Cloud
tirabc
11 Feb, 2025, 09:46

I'm working on OAuth authorization_code flow with HubSpot. The access_token and identity I get after user has been logged in are related to a HubSpot portal (with a hub_id). One user can have many portals so in Appwrite I registered the User with an id like this: 44XXX7714-14XXXXXX5808 (${hubspot.user_id}-${hubspot.hub_id}) but I see in console that User is identified by its email (which obviously is the same for all his portals). And when I try to log in with another portal, I have an error:

TypeScript
ERROR  Failed to create account: A user with the same id, email, or phone already exists in this project.

    at _Client.call (node_modules/node-appwrite/src/client.ts:351:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Users.create (node_modules/node-appwrite/src/services/users.ts:87:13)

How do you think I can register many user profiles (email and hub_id) to avoid the email uniqueness ?

TL;DR
Issue with OAuth authorization_code flow in HubSpot causing email uniqueness error in Appwrite when registering users with multiple profiles (email and hub_id). Solution: Register users with unique identifiers combining email and portal/hub_id to avoid duplicate email issue.
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