@mollie/api-client
Version:
Official Mollie API client for Node
51 lines (50 loc) • 2.15 kB
TypeScript
import type TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import Helper from '../Helper';
import type ClientLink from './ClientLink';
import { type ClientLinkData } from './data';
export interface GetClientLinkParameters {
/**
* The client ID you received when you registered your OAuth app.
* The ID starts with `app_`.
*/
clientId: string;
/**
* A random string generated by your app to prevent CSRF attacks.
* This will be reflected in the `state` query parameter when the user
* returns to the `redirect_uri` after authorizing your app.
*/
state: string;
/**
* A space-separated list of permissions ('scopes') your app requires.
*
* @see https://docs.mollie.com/docs/connect-permissions
*/
scope: string;
/**
* Can be set to `force` to force showing the consent screen to the merchant,
* even when it is not necessary. If you force an approval prompt and the user
* creates a new authorization, previously active authorizations will be revoked.
*
* @default 'auto'
*/
approvalPrompt?: 'auto' | 'force';
}
export default class ClientLinkHelper extends Helper<ClientLinkData, ClientLink> {
protected readonly links: ClientLinkData['_links'];
constructor(networkClient: TransformingNetworkClient, links: ClientLinkData['_links']);
/**
* Returns the complete client link URL where you should redirect your customer to.
*
* The returned URL includes the required OAuth query parameters. Redirect your customer
* to this URL to allow them to log in and link their account, or sign up and proceed
* with onboarding.
*
* After the customer completes the flow, they will be redirected back to your app's
* `redirect_uri` with a `code` parameter (on success) or `error` and `error_description`
* parameters (on failure). The `state` parameter you provided will also be included.
*
* @since 4.4.0
* @see https://docs.mollie.com/reference/create-client-link
*/
getClientLink(parameters: GetClientLinkParameters): string;
}