Quantcast
Channel: User Chris - Stack Overflow
Viewing all articles
Browse latest Browse all 40

Firestore rule split a custom token and see if it matches

$
0
0

I have custom claims set on users, the claims look like

organizations [  933219123_Project-name,  311239123_Different-Project-name]

The first part is the DocumentId in Firestore. is it possible to split or check up until the _ via regex or something? I know we can't use loops in rules

I have a rule that works if I don't include the _Project-name part of the claim when setting them,

  match /databases/{database}/documents {    match /organizations/{uid}/repositories/{document=**} {      allow read: if request.auth != null && uid in request.auth.token.organizations    }  }

However I need both the project ID and name in my claims for the frontend stuff.

Aside from just adding both the ID and name as separate claims (seems wasteful), do I have any other options?


Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>