Hierarchy

  • UserPowers

Index

Methods

Methods

Static getCurrentUser

  • getCurrentUser<T>(): Promise<User<T>>
  • 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.

    example

    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
    }

    Type parameters

    Returns Promise<User<T>>

Generated using TypeDoc