Skip to main content
@qonto/embed-sdk / authLinks

Variable: authLinks

const authLinks: object = authLinksNamespace.authLinks
The authLinks namespace contains all the functions related to authentication link operations. It can be accessed like this:
import { authLinks } from '@qonto/embed-sdk/auth-links';
Then, the authLinks object contains the functions to perform auth link operations:
await authLinks.request({
  requestSettings: {
    action: 'display_card',
    callbackUrl: 'https://example.com/callback'
  },
  operationSettings: {
    // if proxyRequestFunction was passed to initialize, you don't need to pass it again here
    proxyRequestFunction: yourFunctionCallingYourBackend,
  }
});

Type declaration

request()

request: (requestAuthLinkParams) => Promise<AuthLinkRequestResult>
Requests an authentication link for a specific action. Auth links allow loading embed features or performing Embed actions in a secure manner while still avoiding exposing the access token to the client side.

Parameters

requestAuthLinkParams
AuthLinkRequestParams An object containing:
  • requestSettings: An object with the action and an optional callbackUrl properties (both string).
  • operationSettings: An object with operation-level settings such as proxyRequestFunction (preferred over using the access token flow), accessToken, stagingToken, and other optional parameters. See AuthLinkRequestParams.

Returns

Promise<AuthLinkRequestResult> Promise resolving to the auth link details, which includes the URL where the user should be redirected to perform the action, the requested action, the callback URL if it was provided, the expiration time of the link, and the time it was used.

Throws

InvalidParametersError - If the request settings are invalid.

Throws

AuthenticationError - If authentication fails (e.g., invalid or missing access token).

Example

import { authLinks } from '@qonto/embed-sdk/auth-links';
import { AUTH_LINK_ACTIONS } from '@qonto/embed-sdk/constants';

// Request an auth link for displaying a card within an iframe injected to
// your application.
const result = await authLinks.request({
  requestSettings: {
    action: AUTH_LINK_ACTIONS.DISPLAY_CARD,
  },
  operationSettings: {
    proxyRequestFunction: async (encodedCall) => {
      // Implement your proxy logic here, e.g., make a fetch call to your backend
      // which will handle the request to Qonto's API.
    },
  }
});

console.log('Auth link URL:', result.url);
// Use the URL to open an iframe in your website where the card will be displayed.
I