How to add additional information to firebase.auth()

后端 未结 3 1981
梦毁少年i
梦毁少年i 2020-11-29 10:30

How can I add extra attributes phone number and address to this data set? It seems like Firebase documentation doesn\'t specify anything about that.

I have implemen

3条回答
  •  清歌不尽
    2020-11-29 10:59

    This can be done by directly storing your custom data in Firebase Auth as "custom claims" on each user via the Admin SDK on your backend.

    Note this can't be done purely client-side, your server (or you can use a Cloud Function as per the linked guide if you don't already have a server/API set up) needs to make a request through the Admin SDK to securely set the data using the admin.auth().setCustomUserClaims() method:

    https://firebase.google.com/docs/auth/admin/custom-claims#defining_roles_via_an_http_request

提交回复
热议问题