Skip to main content

Credential

Convenience object that provides methods and properties for using a user's authentication tokens.

Once a user is authenticated within an application, the tokens' lifecycle must be managed to ensure it is properly refreshed as needed, is stored in a secure manner, and can be used to perform requests on behalf of the user. This class provides capabilities to accomplish all these tasks, while ensuring a convenient developer experience.

Index

Constructors

constructor

Properties

readonlyoauth2

oauth2: OAuth2Client

OAuth2 client for performing operations related to the user's token.

readonlytoken

token: Token

The token this credential represents.

Methods

introspect

  • introspect(tokenType: TokenType): Promise<TokenInfo>
  • Introspects the given token to retrieve information about it.


    Parameters

    • tokenType: TokenType

      The type of the token to introspect.

    Returns Promise<TokenInfo>

    A promise that resolves to the token information.

refresh

  • refresh(): Promise<void>
  • Attempt to refresh the token.


    Returns Promise<void>

userInfo

  • Fetches the user info for this user.

    In addition to passing the result to the provided completion block, a successful request will result in the `UserInfo` property being set with the new value for later use.


    Returns Promise<UserInfo>