Hierarchy

  • MtLinkSdk

Constructors

Properties

storedOptions: StoredOptions = ...

Methods

  • OAuth authorization method to request user consent to access data via the Link API.

    The only supported flow is authorization code grant with PKCE PKCE If the user is not logged in yet this will show the login screen and redirect the user to the consent screen after they log in. After the user consents, they will be redirected to the redirect URI with an authorization code. If the user is already logged in and has granted consent in the redirection happens immediately.

    You can pass the AuthorizeOptions.forceLogout option to force the user to log in, even if they have an active session.

    You can also choose to display the sign up form when the user is not logged in yet by setting the AuthorizeOptions.authAction option.

    Parameters

    Returns void

    Remark

    You must initialize the SDK via init before calling this API.

    Example

    mtLinkSdk.authorize(options);
    
  • This method generates a URL for OAuth authorization that requires user consent to access data via Link API.

    See authorize API for authorization details. This API has exactly the same parameters as authorize, the only difference is that it returns a URL instead of opening immediately with window.open.

    Parameters

    Returns string

  • Use this function to exchange an authorization code for a token.

    You can optionally pass code via options parameter, otherwise it will automatically extract the code URL parameter of the current URL.

    The code can be used only once. The SDK does not store it internally, you have to store it in your application.

    One way to use this API is by calling it on your redirection page. For example, if authorize redirects to https://yourapp.com/callback?code=somecode, you can call this function in the script loaded on that redirection page and the client library will automatically extract the code to exchange for a token.

    Alternatively, you can extract the code manually from the redirect URL and pass it to this function via the options object yourself.

    If you passed a AuthorizeOptions.codeChallenge option during the authorize or onboard call and wish to exchange the token on the client side application, make sure to set the code verifier used to generate the said codeChallenge here.

    Parameters

    Returns Promise<Token>

    See

    here for more details.

    Throws

    If the ExchangeTokenOptions.code is not set and the SDK fails to extract it from browser URL.

    Throws

    If the ExchangeTokenOptions.redirectUri is not set and it is not set via init.

  • Call init to initialize the SDK and set default options for API calls.

    Some LINK APIs can be used without calling init. Calls related to OAuth require a client ID which can only be set via the init function. These APIs include:

    Parameters

    • clientId: string

      OAuth clientId of the app (please request this from your Moneytree representative if you need one).
      ⚠️ This function will throw an error if this parameter isn't provided.

    • options: InitOptions = {}

      Optional parameters for the SDK. These options include all of the values below and also all options parameters of the other APIs.
      Options values passed here during initialization will be used by default if no options are passed when calling a specific API.
      Available options are documented under AuthorizeOptions and ConfigsOptions refer to each individual link for more details.

    Returns void

    Example

    mtLinkSdk.init(client_id, options);
    
  • Logout current user from Moneytree.

    Parameters

    Returns void

  • This method generates a URL to log out the user.

    This API has exactly the same parameters as logout, the only difference being that it returns a URL instead of opening immediately with window.open.

    Parameters

    Returns string

  • The onboard API allows a new user to get onboard faster without having to go through the registration process. All you have to do is provide an email address and pass the same options parameter as the authorize function. Moneytree LINK will display a consent screen explaining the access requests and applicable scopes. Once the user consents, a new Moneytree account will be created on their behalf and authorization is completed. Resulting behavior will be the same as the authorize redirection flow.

    Onboard will force any current user session to logout, hence you do not have to call logout manually to ensure a clean state.

    If an account with this email address already exists we will redirect the user to the login screen.

    Parameters

    Returns void

    Remark

    ⚠️ You must initialize the SDK via the init before calling this API.

    ⚠️ For legal reasons, you have to set up your app's terms and conditions URL to use the onboard API. Please ask your Moneytree representative for more details.

    Throws

    If the email property is not set (via init or in the options parameter of this function).

  • This method generates a URL for user onboarding.

    This API has exactly the same parameters as onboard, the only difference being that it returns a URL instead of opening immediately with window.open.

    Parameters

    Returns string

  • This is a method to open various services provided by Moneytree such as Moneytree account settings, Vault etc.

    Pass serviceId: 'link-kit' to open the LINK Kit service.

    Parameters

    Returns void

    Remark

    ⚠️ calling this API before calling init will open the services view without branding (company logo etc.)

  • Pass serviceId: 'myaccount' to open the MyAccount service.

    Open different MyAccount sub-pages by passing the MyAccountServiceTypes for all possible options.

    Parameters

    Returns void

    Remark

    ⚠️ calling this API before calling init will open the services view without branding (company logo etc.)

  • Pass serviceId: 'vault' to open the Vault service.

    Depending on the Vault sub-page you want to open, you can pass the following options:

    Parameters

    Returns void

    Remark

    ⚠️ calling this API before calling init will open the services view without branding (company logo etc.)

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Request for a password-less login link to be sent to the user's email address.

    Clicking on the link in the email will log a user in directly to the screen specified by the RequestLoginLinkOptions.loginLinkTo parameter.

    Parameters

    Returns Promise<void>

  • Use this method to send a user identifier to Moneytree so that Moneytree can forward it as saml_subject_id parameter to the Identity Provider (IdP) via the SAMLRequest during SAML SSO flows. See the SAML SSO documentation for details.

    This parameter can be set during init or changed on a request-by-request basis with this method. The saml_subject_id parameter will be forwarded to the authorize, logout and open-service methods when defined.

    Parameters

    • value: string

    Returns void

  • Validate a token and get information about the user or resource server.

    Parameters

    • token: string

    Returns Promise<TokenInfo>

    Throws

    if the token is expired.

Generated using TypeDoc