简体   繁体   中英

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?

不可以,用户ID在所有OAuth提供程序中并不是唯一的,但是如果您将其与提供程序ID连接起来,那么它将是唯一的。

Best way to achieve unique is prefix with OAuth provider,

for example if the user Id return by Facebook is xyz12345 then you can use userid as facebook_xyz12345

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM