bankid_cz
TypeScript icon, indicating that this package has built-in type declarations

0.0.15 • Public • Published

bankid_cz

BankId for Czech republic

Only OAuth authorization code method is available at this moment.

Basic initialization
import {bankIdCz, grantTypes, responseTypes} from 'bankid_cz'

const bankid = new bankIdCz({
  isProduction: true,
  OAuth: {
    clientId: <client_id>,
    clientSecret: <client_secret>,
    redirectURI: 'http://localhost:3030/oauth/callback',
    grantTypes: [grantTypes.authorization_code],
    responseTypes: [responseTypes.code],
    scope: [
      'profile.addresses',
      'profile.birthdate',
      'profile.birthnumber',
      'profile.birthplaceNationality',
      'profile.email',
      'profile.gender',
      'profile.idcards',
      'profile.legalstatus',
      'profile.locale',
      'profile.maritalstatus',
      'profile.name',
      'profile.paymentAccounts',
      'profile.phonenumber',
      'profile.titles',
      'profile.updatedat',
      'profile.zoneinfo',
      'profile.verification'
    ]
  }
});
1. Retrieving authorizationURI and banks

AuthorizationURI is automatically added to banks list.

await bankid.getAuthorizationURI(state?: string);
await bankid.loadBanks(state?: string);
2. Exchanging authorization code for token

After redirection to redirectURI, the code is returned as query param.

await bankid.exchangeCode(code: string);

After this, accessToken is stored in memory and used in future requests.

3. Authorized requests profile and userInfo

Access token is optional. If used, it will be used instead of the stored one by exchangeCode method.

await bankid.loadProfile(accessToken?: string);
await bankid.loadUSerinfo(accessToken?: string);

Package Sidebar

Install

npm i bankid_cz

Weekly Downloads

18

Version

0.0.15

License

GNU

Unpacked Size

52 kB

Total Files

17

Last publish

Collaborators

  • lukas.hronec