API Reference

Core Classes

AuthorizationRequest

Represents an OAuth 2.0 Authorization Request.

  • Properties:
    • clientId: The client identifier.
    • redirectUri: The URI to redirect to after authorization.
    • scope: The scopes requested.
    • responseType: Typically code or token.
    • state: Random string for CSRF protection.

AuthorizationResponse

Represents a successful authorization response containing the code.

TokenRequest

Represents the request to the Token endpoint.

  • grantType: authorization_code or refresh_token.
  • code: The auth code from the response.
  • refreshToken: Used when the grant type is refresh_token.

TokenResponse

Represents the response from the Token endpoint.

  • accessToken: The token used to access protected resources.
  • refreshToken: (Optional) Used to obtain new access tokens.
  • idToken: (Optional) The OpenID Connect ID token.
  • expiresIn: Lifetime of the access token in seconds.

Utilities

Crypto

Interface for cryptographic operations.

  • generateRandom(size: number): Returns a random string.
  • deriveChallenge(code: string): Returns the S256 PKCE challenge.

QueryStringUtils

Interface for serializing and parsing URL parameters.

  • BasicQueryStringUtils: The default implementation using encodeURIComponent.