@creator.co/module-identity-client - v1.1.11
    Preparing search index...

    Represents an SessionAuthorization class that handles authorization using JWT tokens.

    Index

    Constructors

    • Constructs a new instance of the TokenDecoder class.

      Parameters

      • token: string

        The token to be decoded.

      • jwtAPIMode: boolean

        A boolean indicating whether the token is in JWT API mode.

      Returns default

      None

    Accessors

    Methods

    • Check if the token is valid and if it has expired.

      Returns { expired: boolean; valid: boolean }

      • An object with two boolean properties, valid and expired.
    • Retrieves the agency IDs from the decoded token payload.

      Returns string[]

      The agency IDs if present in the decoded token payload, otherwise null.

    • Retrieves the brand IDs from the decoded token payload.

      Returns string[]

      The brand IDs if available, otherwise null.

    • Retrieves the claims from the decoded token, specifically the 'cognito:groups' claim.

      Returns null | string[]

      An array of strings representing the groups the user belongs to, or null if the claim is not present.

    • Retrieves the IDM groups from the decoded token payload.

      Returns string[]

      The IDM groups if available, otherwise null.

    • Retrieves a specific parameter from the decoded token payload.

      Parameters

      • param: string

        The parameter to retrieve from the decoded token payload.

      Returns any

      The value of the specified parameter, or undefined if the parameter does not exist.

    • Retrieves the user's email from the decoded token.

      Returns null | string

      The user's email if available, otherwise null.

    • Retrieves the user ID from the decoded token payload.

      Returns null | string

      The user ID if present in the decoded token payload, otherwise null.

    • Checks if the token is valid by verifying if it exists, has a decoded token payload, and if the expiration time is greater than the current time.

      Returns boolean

      true if the token is valid, false otherwise