Skip to content

Commit

Permalink
Get super admin status from firstore listener, not custom auth claims
Browse files Browse the repository at this point in the history
  • Loading branch information
richford committed Feb 10, 2024
1 parent cdf49c4 commit 754366f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/firestore/firekit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export class RoarFirekit {
async (doc) => {
const data = doc.data();
this._adminOrgs = data?.claims?.adminOrgs;
this._superAdmin = data?.claims?.super_admin;
if (data?.lastUpdated) {
const lastUpdated = new Date(data!.lastUpdated);
if (!firekit.claimsLastUpdated || lastUpdated > firekit.claimsLastUpdated) {
Expand Down Expand Up @@ -303,7 +304,6 @@ export class RoarFirekit {
if (user) {
const idTokenResult = await user.getIdTokenResult(false);
if (_type === 'admin') {
this._superAdmin = Boolean(idTokenResult.claims.super_admin);
this._idTokenReceived = true;
}
this._idTokens[_type] = idTokenResult.token;
Expand Down

0 comments on commit 754366f

Please sign in to comment.