Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AuthenticationClient

Client providing access to Autodesk Forge authentication APIs.

tutorial

authentication

Hierarchy

  • AuthenticationClient

Index

Constructors

constructor

  • new AuthenticationClient(client_id: string, client_secret: string, host?: string): AuthenticationClient
  • Initializes new client with specific Forge app credentials.

    Parameters

    • client_id: string

      Forge application client ID.

    • client_secret: string

      Forge application client secret.

    • host: string = 'https://developer.api.autodesk.com'

    Returns AuthenticationClient

Properties

Private _cached

_cached: {}

Type declaration

  • [key: string]: ITokenCache

Private client_id

client_id: string

Private client_secret

client_secret: string

Private host

host: string

Accessors

clientId

  • get clientId(): string

Methods

authenticate

  • authenticate(scopes: string[], force?: boolean): Promise<ITwoLeggedToken>
  • Retrieves 2-legged access token for a specific set of scopes (docs). Unless the {@see force} parameter is used, the access tokens are cached based on their scopes and the 'expires_in' field in the response.

    Parameters

    • scopes: string[]

      List of requested scopes.

    • force: boolean = false

    Returns Promise<ITwoLeggedToken>

    Promise of 2-legged authentication object containing two fields, 'access_token' with the actual token, and 'expires_in' with expiration time (in seconds).

getAuthorizeRedirect

  • getAuthorizeRedirect(scopes: string[], redirectUri: string): string
  • Generates a URL for 3-legged authentication.

    Parameters

    • scopes: string[]

      List of requested scopes.

    • redirectUri: string

      Same redirect URI as defined by the Forge app.

    Returns string

    Autodesk login URL.

getToken

  • Exchanges 3-legged authentication code for an access token (docs).

    async

    Parameters

    • code: string

      Authentication code returned from the Autodesk login process.

    • redirectUri: string

      Same redirect URI as defined by the Forge app.

    Returns Promise<IThreeLeggedToken>

    Promise of 3-legged authentication object containing 'access_token', 'refresh_token', and 'expires_in' with expiration time (in seconds).

getUserProfile

  • Gets profile information for a user based on their 3-legged auth token (docs).

    async

    Parameters

    • token: string

      3-legged authentication token.

    Returns Promise<IUserProfile>

    User profile information.

Protected post

  • post(endpoint: string, params: any): Promise<AxiosResponse<any>>
  • Parameters

    • endpoint: string
    • params: any

    Returns Promise<AxiosResponse<any>>

refreshToken

Generated using TypeDoc