Search code examples
javaoauthuserid

Is user id unique across all OAuth providers?


My website use OAuth to achieve social sign in, we need to create a unique local account for each OAuth users, currently we use String id as an identity of each unique user, but if two users from different OAuth providers with same id there will be collision.

My questions are:

  1. Is user id unique across all OAuth providers, such as Facebook, Twitter, Google...?
  2. I see some of the providers use String id and some with Long id, is it safe to just convert long id to String and keep unique?

Solution

  • No, user id is not unique across all OAuth providers, but if you connect it with the provider id then it will be.