1

if i would like to have two registration providers (password, facebook). What is the best way to store user's id?

In this comment kato says that firebase provides unique uid.

But the uids looks like:

uid: facebook:10000000477077
uid: simplelogin:48

Currently i have /users/< id >

And now i would have /users/< uid > ? like /users/facebook:10000000477077 ?

Is that good from performance view or am i missing something? Because better then this uid would be even an unique username or not?

Thank you.

Community
  • 1
  • 1
Lukas Lukac
  • 7,766
  • 10
  • 65
  • 75

1 Answers1

1

While the id attribute is the id for the specified provider, but the uid, as you mention, is unique across all providers. There's no negative performance impact for using these attributes for your user ids, and is recommended if you are allowing users to log in across many different providers.

Alternatively, you could store your users as /users/<provider>/<id>, such as /users/facebook/12345 which also addresses the concern around collisions.

Rob DiMarco
  • 13,226
  • 1
  • 43
  • 55
  • yea but i also need to use this unique uid in other paths... like i dont know /user_whatever/ etc... i am used to mysql way that the best key where you do join queries should be integer foreign key you know that's why i am curious if there is no some bad performance decision to use . So you are saying it's absolutly okay yes? Thx. – Lukas Lukac Mar 28 '14 at 09:09