Fetch the user associated with the current event. For system events, such as, CRON scheduled events, the user may be associated with a "system" user.
Sample user fetch and claim deconstruction:
type AppClaims = { appRole: string; email: string; }; const user = await UserPowers.getCurrentUser<AppClaims>(); const { applicationId, organizationId, conversationId, external: appClaims } = user; if (appClaims.appRole === "Administrator") { // custom functionality for Administrators }
Generated using TypeDoc
Fetch the user associated with the current event. For system events, such as, CRON scheduled events, the user may be associated with a "system" user.
Sample user fetch and claim deconstruction:
type AppClaims = { appRole: string; email: string; }; const user = await UserPowers.getCurrentUser<AppClaims>(); const { applicationId, organizationId, conversationId, external: appClaims } = user; if (appClaims.appRole === "Administrator") { // custom functionality for Administrators }