This package will help you make requests to the BankID HTTP/JSON API.
- A pfx certificate issued by a certified Bank.
- The request module needs to be installed as a dependency.
Run the following command in your terminal to install the module to your project.
npm install @oddhill/bankid request
yarn add @oddhill/bankid request
Below is an example showing how to use the library when making a request to the Authenticate method on the BankID HTTP/JSON API.
const bankid = require('bankid);
const options = {
pfx: './path-to-your-pfx-certificate.pfx',
passphrase: 'certpassphrasse',
};
bankid(options, (err, service) => {
if (err) console.log(err);
const args = {
personalNumber: '199801011234',
endUserIp: '192.168.0.1',
};
service.authenticate(args, (err, response) => {
console.log(response);
});
});