FiskilFiskilFiskil DocsFiskil Docs
Log InSign Up
GuidesAPI ReferenceChangelog

Mobile menu

HomeFiskilFiskil
Log InSign Up
Introduction

Getting Started

AuthenticationErrorsPagination

CORE RESOURCES

Linking Accounts

BANKING API

ENERGY API

IDENTITY

Auth Session

Create authorization sessions for end users to grant data access.

AI Actions

An Auth Session is a single-use session for an end user to authorize data sharing from an institution. It generates a unique URL where users can complete the consent flow.

Endpoints

MethodEndpointDescription
POST/v1/auth/sessionCreate a new auth session

The Auth Session Model

AttributeTypeRequiredDescription
idstringYesThe client ID
session_idstringYesThe unique session identifier
auth_urlstringYesThe URL where the user should be redirected to complete authorization
expires_atintegerYesUnix timestamp when the auth session expires

Example Response

{
  "id": "5qcql2s0bn9qfh1m5qd1sl4gth",
  "session_id": "ea564d-56012s4-6ds4564",
  "auth_url": "https://auth.fiskil.com/redirect-url",
  "expires_at": 1621083785
}

Create Auth Session

Create a new session for the authentication flow.

POST https://api.fiskil.com/v1/auth/session

Request Body

ParameterTypeRequiredDescription
end_user_idstringYesThe ID of the end user to create the session for
redirect_uristringNoURL to redirect to after successful authorization
cancel_uristringNoURL to redirect to if the user cancels
institution_idstringNoPre-select a specific institution
permissionsarrayNoSpecific permissions to request

Example Request

curl --request POST \
  --url https://api.fiskil.com/v1/auth/session \
  --header 'Authorization: Bearer {access_token}' \
  --header 'accept: application/json; charset=UTF-8' \
  --header 'content-type: application/json; charset=UTF-8' \
  --data '{
    "end_user_id": "482c0e2b-5866-46b1-b795-220b7bba45b5",
    "redirect_uri": "https://yourapp.com/callback",
    "cancel_uri": "https://yourapp.com/cancel"
  }'
const response = await fetch('https://api.fiskil.com/v1/auth/session', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer {access_token}',
    'accept': 'application/json; charset=UTF-8',
    'content-type': 'application/json; charset=UTF-8'
  },
  body: JSON.stringify({
    end_user_id: '482c0e2b-5866-46b1-b795-220b7bba45b5',
    redirect_uri: 'https://yourapp.com/callback',
    cancel_uri: 'https://yourapp.com/cancel'
  })
});

const session = await response.json();
console.log(session.auth_url);
import requests

response = requests.post(
    'https://api.fiskil.com/v1/auth/session',
    headers={
        'Authorization': 'Bearer {access_token}',
        'accept': 'application/json; charset=UTF-8',
        'content-type': 'application/json; charset=UTF-8'
    },
    json={
        'end_user_id': '482c0e2b-5866-46b1-b795-220b7bba45b5',
        'redirect_uri': 'https://yourapp.com/callback',
        'cancel_uri': 'https://yourapp.com/cancel'
    }
)

session = response.json()
print(session['auth_url'])

Example Response

{
  "id": "5qcql2s0bn9qfh1m5qd1sl4gth",
  "session_id": "ea564d-56012s4-6ds4564",
  "auth_url": "https://auth.fiskil.com/consent?session=ea564d-56012s4-6ds4564",
  "expires_at": 1621083785
}

Using the Auth Session

After creating an auth session, redirect the user to the auth_url:

// Redirect to Fiskil's authorization page
window.location.href = session.auth_url;

The user will then:

  1. Select their institution (bank or energy provider)
  2. Log in to their institution
  3. Select which accounts to share
  4. Confirm the consent

Handling Callbacks

Success Callback

When the user successfully completes authorization, they are redirected to your redirect_uri with the session information:

https://yourapp.com/callback?session_id=ea564d-56012s4-6ds4564

Cancel/Error Callback

If the user cancels or an error occurs, they are redirected to your cancel_uri with error details:

https://yourapp.com/cancel?error=access_denied&error_type=CONSENT_ENDUSER_DENIED&error_description=User+cancelled+the+flow

See Errors for a complete list of error types.

Session Expiration

Auth sessions expire after a short period (typically 10-15 minutes). If a session expires before the user completes authorization, you'll need to create a new session.

Auth sessions are single-use. Once used (whether successfully or not), a new session must be created for subsequent authorization attempts.

Integration Patterns

Redirect Flow

The standard flow where users are redirected to the Fiskil-hosted consent UI:

// Create session
const session = await createAuthSession(endUserId);

// Store session_id for callback verification
sessionStorage.setItem('fiskil_session', session.session_id);

// Redirect user
window.location.href = session.auth_url;

Popup Flow

Open the consent flow in a popup window:

const session = await createAuthSession(endUserId);

const popup = window.open(
  session.auth_url,
  'FiskilConsent',
  'width=500,height=700,menubar=no,toolbar=no'
);

// Monitor for popup close or completion
const checkPopup = setInterval(() => {
  if (popup.closed) {
    clearInterval(checkPopup);
    // Handle completion or cancellation
  }
}, 500);

Embedded Flow (iframe)

Embed the consent flow within your application:

<iframe
  id="fiskil-consent"
  src="{auth_url}"
  width="100%"
  height="600"
  allow="payment"
></iframe>

<script>
window.addEventListener('message', (event) => {
  if (event.origin !== 'https://auth.fiskil.com') return;
  
  if (event.data.type === 'consent_complete') {
    // Handle successful consent
  } else if (event.data.type === 'consent_error') {
    // Handle error
  }
});
</script>

Best Practices

  1. Store Session ID: Always store the session_id so you can verify the callback is legitimate.

  2. Handle Expiration: Create a new session if the user returns after the session has expired.

  3. Pre-select Institution: If you know which institution the user wants to connect, pass the institution_id to skip the selection step.

  4. Configure Redirect URIs: Ensure your redirect and cancel URIs are configured in the Fiskil Console.

Was this page helpful?

AccountsAuthentication

On this page

EndpointsThe Auth Session ModelExample ResponseCreate Auth SessionRequest BodyExample RequestExample ResponseUsing the Auth SessionHandling CallbacksSession ExpirationIntegration PatternsRedirect FlowPopup FlowEmbedded Flow (iframe)Best Practices