Skip to content
Open Banking Authorization NodeJS SDK
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
example OB 3.1 Apr 5, 2019
src OB 3.1 Apr 5, 2019


What is NodeJs-SDK?

This SDK provides tools for the integration of the Open Banking authorization flow into your NodeJs server application.

This repository contains two subfolders:

  • /src contains the SDK source code
  • /example contains an example on how to use the SDK

How to use SDK

First read throught the Authorization part of API documentation.

Account-information API documentation: https://<sandbox_portal_host_of_the_bank>/api-documentation/account-info-1.0

Payment-initiation API documentation: https://<sandbox_portal_host_of_the_bank>/api-documentation/payment-init-1.0

Create an OpenBankingAuth istance

OpenBankingAuth(clientId, privateKey, keyID, redirectUri, tokenEndpointUri, authEndpointUri, scope, issuer, jwksUri) - constructor

Required parameters

  • clientId (e.g. myApp@account-info.1.0)
  • privateKey (your private key, the public key has to be uploded on the developer portal)
  • keyID (the id of the keypair in your keystore, can be any string)
  • redirectUri (the OAuth2 callback url of your application)
  • tokenEndpointUri (token endpoint uri of OIDC server)
  • authEndpointUri (authentication endpoint uri of OIDC server)
  • scope (depends on API, read documentation)
  • jwksUri (certs endpoint uri of OIDC server)
  • issuer = (sandbox endpoint uri of OIDC server);


const OpenBankingAuth = require('../src/OpenBankingAuth').OpenBankingAuth;
var accountInfoAuth = new OpenBankingAuth(clientId, privateKey, keyID, redirectUri, tokenEndpointUri, authEndpointUri, scope, issuer, jwksUri);

Get an access-token



var accessToken = await accountInfoAuth.getAccessToken();

Generate authorization url

generateAuthorizationUrl(intentId, state, nonce):string

Required parameters

  • intentId (identification of previously created intent, e.g. ConsentId)
  • state (random string)
  • nonce (random string)


var authUrl = await accountInfoAuth.generateAuthorizationUrl(intentId, state, nonce);

Exhange authorization code to tokens


Required parameters

  • code (the authorization code received from the authorization server)


var newTokens = await accountInfoAuth.exchangeToken(code);

Extra functionality

Create signature header


Required parameters

  • body (intent, e.g. an account-request)


var xJwsSignature = await accountInfoAuth.createSignatureHeader(body);

Check if a token is expired

isTokenExpired(token [, expiredAfterSeconds]):boolean

Required parameters

  • token (jwt)

Optional parameters

  • expiredAfterSeconds (number of seconds * 1000)


var isExpired = accountInfoAuth.isTokenExpired(token, 5000); // will token expire after five seconds?

Use a refresh token


Required parameters

  • refresh token


var newTokens = accountInfoAuth.refreshToken(refreshToken);

How to run the example

Open example/app.js and replace <sandbox_api_host_of_the_bank> with correct value (e.g.

Run example.

cd example
npm start

Open your browser and navigate to http://localhost:3000/account-info or http://localhost:3000/payment-init.

You can’t perform that action at this time.