matrix-js-sdk

    Class TokenRefresher

    This class is responsible for managing the access token and refresh token for authenticated requests. It will automatically refresh the access token when it is about to expire, and will handle unknown token errors.

    Index

    Constructors

    Methods

    • This function is called when an M_UNKNOWN_TOKEN error is encountered. It will attempt to refresh the access token if it is unknown, and will return a TokenRefreshOutcome.

      Parameters

      • snapshot: Snapshot

        the snapshot returned by prepareForRequest

      • attempt: number

        the number of attempts made for this request so far

      Returns Promise<TokenRefreshOutcome>

      a TokenRefreshOutcome indicating the result of the refresh attempt

    • This function is called before every request to ensure that the access token is valid.

      Returns Promise<Snapshot>

      a snapshot containing the access token and other properties which must be passed to the handleUnknownToken handler if an M_UNKNOWN_TOKEN error is encountered.

    MMNEPVFCICPMFPCPTTAAATR