Marketplace
>
authClaims
firestore

authClaims

v
0.0.1
Latest Version
Likes
0
Installations
0
Views
0
11

Overview

Set custom claims for Firebase Auth users from values set in Firestore.

Usage

### How this function works This function will automatically sync data from the specified collection to custom claims on a corresponding Firebase Auth user. ### Prerequisites - You must have previous knowledge of **Firestore**. - You must have previous knowledge of **Firebase Auth**. ### Function details In order to complete the installation process, you must add the required info to the form: - **Document Path**: The document path that you'd like this function to listen to. A placeholder should be used for the document ID (e.g., /collection/{docId}). - **CLAIMS_FIELD**: The name of the document field where the custom claims will be stored. > Leave **CLAIMS_FIELD** blank to use all data in the document as custom claims. Custom claims must be an object. The following is an example of how to use this function: ``` CLAIMS_FIELD:{ role: "admin", groups: ["example1", "example2"] } ``` Once the document has been written, the extension will automatically set the same custom claims (in this case, role and groups) on the Firebase Auth user with a UID corresponding to the document ID. Then in a few seconds, you will see a `_synced` field appear with the timestamp of when the claims were set. ``` _synced: Mon Dec 27 2021 00:59:31 GMT-0600 ``` ### Resources - [Custom Claims](https://firebase.google.com/docs/auth/admin/custom-claims)
Cost
FREE
Cost
Version
0.0.1
Language
JAVASCRIPT
Created At
Updated At
Workspace
firestore
Tags
auth
firestore
claims
© 2023 Function Store