문제

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?
도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top