Tink.Credentials (Tink v1.0.0)

Copy Markdown View Source

Bank credential (connection) lifecycle management.

A credential represents a user's authenticated connection to a bank via Tink. Credentials are created during a Tink Link flow and must be refreshed as bank consent periods expire.

Scopes

  • credentials:read — list, get, QR
  • credentials:write — create, delete
  • credentials:refresh — refresh, authenticate, supplemental info

Summary

Functions

Trigger re-authentication for a credential. Requires credentials:refresh.

Create a new credential (bank connection). Requires credentials:write.

Delete a credential. Requires credentials:write.

Get a specific credential by ID. Requires credentials:read.

Get the QR code for a credential. Used for some bank authentication flows. Requires credentials:read.

List all credentials for the authenticated user. Requires credentials:read.

Trigger a data refresh for a credential. Requires credentials:refresh.

Submit supplemental information for a credential (MFA / BankID / challenge response). Requires credentials:refresh.

Functions

authenticate(client, credential_id)

@spec authenticate(Tink.Client.t(), String.t()) ::
  {:ok, map()} | {:error, Tink.Error.t()}

Trigger re-authentication for a credential. Requires credentials:refresh.

create(client, params)

@spec create(Tink.Client.t(), map()) :: {:ok, map()} | {:error, Tink.Error.t()}

Create a new credential (bank connection). Requires credentials:write.

delete(client, credential_id)

@spec delete(Tink.Client.t(), String.t()) :: :ok | {:error, Tink.Error.t()}

Delete a credential. Requires credentials:write.

get(client, credential_id)

@spec get(Tink.Client.t(), String.t()) :: {:ok, map()} | {:error, Tink.Error.t()}

Get a specific credential by ID. Requires credentials:read.

get_qr(client, credential_id)

@spec get_qr(Tink.Client.t(), String.t()) :: {:ok, map()} | {:error, Tink.Error.t()}

Get the QR code for a credential. Used for some bank authentication flows. Requires credentials:read.

list(client)

@spec list(Tink.Client.t()) :: {:ok, map()} | {:error, Tink.Error.t()}

List all credentials for the authenticated user. Requires credentials:read.

refresh(client, credential_id)

@spec refresh(Tink.Client.t(), String.t()) :: {:ok, map()} | {:error, Tink.Error.t()}

Trigger a data refresh for a credential. Requires credentials:refresh.

submit_supplemental_info(client, credential_id, fields)

@spec submit_supplemental_info(Tink.Client.t(), String.t(), [map()]) ::
  {:ok, map()} | {:error, Tink.Error.t()}

Submit supplemental information for a credential (MFA / BankID / challenge response). Requires credentials:refresh.

Example

Tink.Credentials.submit_supplemental_info(client, credential_id, [
  %{"name" => "otp", "value" => "123456"}
])