Skip to content

Commit

Permalink
add phoneVerified to custom claims
Browse files Browse the repository at this point in the history
  • Loading branch information
juancwu committed Apr 18, 2024
1 parent 4e2b573 commit e268025
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const addDefaultClaims = functions.auth.user().onCreate(async (user) => {
await admin.auth().setCustomUserClaims(uid, {
// Default Claims
admin: false, // Example: set to true for admin users
phoneVerified: false,
});
console.log(`Custom claims added for user: ${uid}`);
} catch (error) {
Expand Down
2 changes: 2 additions & 0 deletions src/providers/auth.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type { ApplicationData } from "@/components/forms/types";

export interface UserWithRole extends User {
hawkAdmin: boolean;
phoneVerified: boolean;
}

export type ProviderName = "github" | "google" | "apple";
Expand Down Expand Up @@ -63,6 +64,7 @@ async function validateUserRole(user: User): Promise<UserWithRole> {
return {
...user,
hawkAdmin: Boolean(claims.admin),
phoneVerified: Boolean(claims.phoneVerified),
};
}

Expand Down

0 comments on commit e268025

Please sign in to comment.