Skip to main content

Credentials

Flinks uses three credentials. Each serves a different purpose in the authentication flow.
CredentialWhat it isHow you get itLifetime
Secret keyA key that identifies your integration and grants access to Flinks APIs.Provided by Flinks during integration setup.Does not expire.
Authorize tokenA one-time token that authenticates a single session.Generated by calling /GenerateAuthorizeToken with your secret key.Single-use. Expires after 30 minutes if unused.
x-api-keyA security header required on data endpoints.Provided by Flinks during integration setup.Does not expire.

Headers by endpoint

The flinks-auth-key header is used on two endpoints but carries a different value on each.
EndpointHeaderValueRequired
/GenerateAuthorizeTokenflinks-auth-keyYour secret keyYes
/Authorizeflinks-auth-keyYour authorize tokenYes
Flinks Connect iframeURL parameterauthorizeToken={token}Yes
/GetAccountsDetailx-api-keyYour x-api-keyYes
/GetAccountsDetailAsyncx-api-keyYour x-api-keyYes
/GetAccountsSummaryx-api-keyYour x-api-keyYes
Data endpoints (/GetAccountsDetail, /GetAccountsDetailAsync, /GetAccountsSummary, etc.) authenticate using the RequestId returned by /Authorize and the x-api-key header. They do not require the flinks-auth-key header.
Do not confuse the secret key with the authorize token. The secret key generates tokens. The authorize token authenticates sessions. Using the wrong value in the flinks-auth-key header causes 401 errors.

Authentication flow

Step 1: Generate an authorize token

Call /GenerateAuthorizeToken with your secret key in the flinks-auth-key header. The response contains a one-time authorize token.

Step 2: Authenticate with the authorize token

How you pass the authorize token depends on your integration type:
  • Flinks Connect: Add authorizeToken={token} as a URL parameter on the iframe URL.
  • Direct API: Pass the authorize token in the flinks-auth-key header when calling /Authorize.
/Authorize returns a RequestId that you use to call data endpoints.

Step 3: Call data endpoints

Pass the RequestId to data endpoints such as /GetAccountsDetail. No flinks-auth-key header is needed on data endpoints. For the full data retrieval flow after authentication, see Retrieve Account Data. The authorize token expires after 30 minutes. The /GenerateAuthorizeToken endpoint does not return a TTL, so your application must handle expiry reactively. If the user does not complete the connection flow within 30 minutes, Flinks Connect emits a JavaScript event:
{ "step": "TOKEN_INVALID" }
When you receive this event, generate a new authorize token and reload the iframe with the updated authorizeToken parameter.

Implementation

Listen for TOKEN_INVALID alongside your other Flinks Connect events:
window.addEventListener("message", function (e) {
  if (e.data && e.data.step === "TOKEN_INVALID") {
    // 1. Call your backend to generate a new authorize token
    //    (your backend calls /GenerateAuthorizeToken with the secret key)
    // 2. Reload the iframe with the new token
    const iframe = document.getElementById("flinks-connect");
    const newUrl = iframe.src.replace(/authorizeToken=[^&]+/, "authorizeToken=" + newToken);
    iframe.src = newUrl;
  }
});
Generate the authorize token from your backend. Do not expose your secret key in frontend code.

Common authentication errors

ErrorFlinks CodeCause
401ACCESS_DENIEDInvalid or missing credentials on /Authorize.
401UNAUTHORIZED/GetAccountsDetail called before completing authorization or MFA.
401SESSION_EXPIREDRequestId expired after 8 minutes of inactivity or 30 minutes of data processing.
401INVALID_REQUESTMalformed request body, missing headers, or URL formatting errors (e.g., double slash //v3).
401INVALID_LOGINThe LoginId passed to /Authorize does not exist or is invalid.
For the full error code list, see Error Codes. For step-by-step debugging, see Authentication Troubleshooting.