Перейти до змісту

Setup BankID 🔧

Prepare test environment

Test certificates 🧾

  1. Goto https://www.bankid.com/en/utvecklare/test
  2. Click "Download ⬇"
  3. You'll get .p12 file
  4. To parse key.pem from it, use this command:

    openssl pkcs12 -in <FILE>.p12 -out key.pem -nocerts -nodes -legacy -passin 'pass:<PASSWORD>'
    

    Where -in must be a filename and path to .p12 file, password -passin 'pass:<PASSWORD>'

    Example

    openssl pkcs12 -in FPTestcert4_20220818.p12 -out key.pem -nocerts -nodes -legacy -passin 'pass:qwerty123'
    
    This command will produce key.pem file

    Tip

    Usually test password for BankID .p12 file is: qwerty123

  5. To parse cert.pem from it, use this command:

    openssl pkcs12 -in <FILE>>.p12 -out cert.pem -clcerts -nokeys -legacy -passin 'pass:<PASSWORD>'
    

    Example

    openssl pkcs12 -in FPTestcert4_20220818.p12 -out cert.pem -clcerts -nokeys -legacy -passin 'pass:qwerty123'
    
    This command will produce cert.pem file

  6. Copy inner certificate and key data to your environment variables or .env file, for example:

Example of .env file
BANK_ID_HOST=https://appapi2.test.bankid.com/rp/v5.1
BANK_ID_CERTIFICATE='-----BEGIN CERTIFICATE-----
MIIEyjCCArKgAwIBAgIIMLbIMaRHjMMwDQYJKoZIhvcNAQELBQAwcTELMAkGA1UE
BhMCU0UxHTAbBgNVBAoMFFRlc3RiYW5rIEEgQUIgKHB1YmwpMRUwEwYDVQQFEwwx
MTExMTExMTExMTExLDAqBgNVBAMMI1Rlc3RiYW5rIEEgUlAgQ0EgdjEgZm9yIEJh
bmtJRCBUZXN0MB4XDTIyMDgxNzIyMDAwMFoXDTI0MDgxODIxNTk1OVowcjELMAkG
A1UEBhMCU0UxHTAbBgNVBAoMFFRlc3RiYW5rIEEgQUIgKHB1YmwpMRMwEQYDVQQF
Ewo1NTY2MzA0OTI4MRcwFQYDVQQpDA5UZXN0IGF2IEJhbmtJRDEWMBQGA1UEAwwN
RlAgVGVzdGNlcnQgNDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL4L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Z0LFEQg68G+J1hIz6PQEuhAJqk8
rYHXnTQ0qUw7R6gez2KoXp8wnFMCgYEA1E13E5NKs/VKctUQqXcKpy7VL017yBH8
J2RTjDLVGh6BFcR9wGm5ipE659TpNKdqPN17bGPGj5MOdZL1+sGVTRkg4vSZeZuE
kpw192KgwNoDznjeVH5qY7VM8Zy2DI91mg2NQTQiMF0mRLaenMOfzFBjHwQZ2J/J
ecT3Vwepgp8CgYAsocIyzRVTnklU4RBHFDmBzwrDUklZUKT2oixmmL3Rr/wM7VyX
w0gDRRF9h4Ylz0A2/9+t1Q5U04tcidJDJePo6fYxFpDL05MNkLSETIdnqun1g8PK
FJi3BLsPq2UuBYHfb9Zeem0gAZPc88EZmdxAhdZr0qkI/7lgcrqQEzkIeQKBgGri
kVfOqSaPEStdL+VR5JAlGPmWtgIVY/DlJtcH5Jgg0XaHFZSg5ePomFKNs9dpjigU
jgYU+avhKr9w/NyBR8yoIRGCeh5qeMVjVhw1kJ9nY9E4sx6xApkudw2Ri2opc9ja
h8pTF/9ndlPT6WkdaD9yHWVJKEYStFnVG326gtIbAoGAetLNOSZBSW03SJlI7dhY
4hycNElfSd0t89Bf4YcYbWrpySeKCG0oTO7Y56ZS9RmgNEyz4HNXZcQ56inMNY6Z
M+o1wGEKJKLBtCJHZp7Sh8zy/RMI3naF4vc4r4BpK9k5ZAEL8gHVm9M5C2ZG8whc
r+Uu/g0P3m8w7INgsjxQy/U=
-----END PRIVATE KEY-----'

Test account 💼

Here is a guide: Get BankID for test

Issue personal code

Tip

Use this method when you set up your environment for the first time. Otherwise, use this methods mobile or desktop.

  1. Goto https://demo.bankid.com/ordercode
  2. Fill form with your data (organization, email, project, fist name, last name)

    Organization email

    Email should be a corporate, emails with @gmail.com domain wouldn't work❗

    Demo BankID Generate Code

  3. Goto your corporate email, you'll obtain a test 30-days trial code.

Login with personal code

  1. Use this code to log in https://demo.bankid.com/logincode Demo BankID Login
  2. It's all, now you'll be able to set up Mobile / Desktop BankID environments.

Login with mobile app

This is method to log in to test account using mobile app and QR code.

Tip

Use this method when you already set up your test account via personal code Issue personal code.

  1. Go to https://demo.bankid.com/logintest
  2. Open your BankID test app and scan QR code.

    Warning

    Mobile app should be configured, read here Mobile test environments.

Login with desktop app

This is method to log in to test account using desktop app.

Tip

Use this method when you already set up your test account via personal code Issue personal code.

  1. Go to https://demo.bankid.com/logintest
  2. Click "Alternative: Start BankID Security Application on this device.".

    Warning

    Mobile app should be configured, read here Mobile test environments.

Mobile test environments

Test Android app 📱

Here is a guide: BankID test configuration

  1. Install BankID app from your app store.

    Install

  2. Enable "airplane mode".

  3. Open BankID app (you'll be notified that is no connection, click "OK").

    3.1 Click "⚙ Settings".

    3.2 Click "About BankID".

    3.3 Make a "long press" on the heading Error information in the input dialog enter kundtest and save.

    Open app Settings About BankID

    Note

    If everything is "OK", it appears CUST after the Version.

  4. Exit app, and also close it from background.

  5. Disable "airplane mode".
  6. Done.

Test iOS app 📱

  1. Uninstall any existing version of BankID Security App and then reinstall it from App Store.

  2. In Settings → BankID → Developer → Server, enter cavainternal.test.bankid.com.

  3. Done, BankID Security App will connect to the test server.

Note

Please note that the app must be uninstalled/reinstalled to be restored for the production environment.

TODO Screenshots

If you have an iPhone you can help to document it with screenshots (Contributors welcome).

Desktop test environments

Test Windows app 🖥

  1. Download windows BankID desktop application (extra link)
  2. Install it.
  3. Run & close application.
  4. Go to this path: C:\Users\USER_NAME\AppData\Roaming\BankID\Config

    where USER_NAME - your Window's user.

  5. Create file with name CavaServerSelector.txt

  6. Write kundtest inside file and save it.
  7. Open application, navigate to: "File" → "Preferences" → "Info for support" → "Check connections" → click "Check".

    You should get:

    • BankID server: OK
    • Update server: OK

    Test check

  8. Done.

Test MacOS app 💻

TODO

If you have a Macbook, you can help to document it with screenshots (Contributors welcome).

Generate personal number (customizable)

  1. Goto Personal number generator
  2. Select "Output format" as "YYYYMMDDNNNN".
  3. Select your gender.
  4. Fill out "Date of birth".

Example

Generate personal number

Generate random personal number with (fejk.se)

  1. Generate personal number at: https://fejk.se/
  2. Get date of birth (without dashes).
  3. Get latest 4 digits of personnummer.
  4. Concatenate it without dashes.

Example

1) Date of birth 1996-10-2119961021 (remove dashes)

2) End of personal number -12381238 (removed dash)

3) Result 19961021 + 1238199610211238 (must be 12 digits length) Generate personal number

Issue BankID for test

  1. Login to Demo Bank.

    Tip

    First time login: personal code.

    Subsequent time login: mobile, desktop.

  2. Click selected button under "Issue BankID for Test".

    Tip

    • "Mobile BankID" - for mobile 📱;
    • "BankID on file" - for desktop 🖥;

    Issue BankID for Test

  3. Fill data into fields (first name, last name, personal number).

    Issue for test

    Tip

    You can use random first name and last name.

  4. Click "Issue" and proceed with connection section, depends on your choice (mobile or desktop).

Connect with Android 📱

Before start: requirements

  1. Click "Issue" under "Mobile BankID" form. Issue BankID for phone

  2. It will open modal window with QR code. QR BankID for phone

  3. Open BankID app.

  4. Click "New BankID".

    New BankID

  5. It will open scanner, scan QR code inside modal window.

    Success screen at mobile:

    Activation completed

    Success screen at modal:

    Activation completed

  6. You can enable fingerprint to easy approve BankID confirmation.

    Enable fingerprint Confirmation Security code Check fingerprint Check fingerprint completed

  7. You can check new test BankID connection inside your "Settings" under the BankID tab.

    Note

    P.S. Also your main screen now will have "QR code" button instead of "New BankID"

    Main screen Connected settings

Connect with iOS 📱

Warning

If you have an iPhone you can help to document it with screenshots (Contributors welcome).

Connect with Windows 🖥

Before start: requirements

  1. Click "Issue" under "BankID on file" form. Issue BankID for phone

  2. Click "Open BankID issuing".

  3. It will open modal window with QR code. Modal

    Click "I have the most recent BankID application, proceed without installation >"

  4. Click "Continue >". Continue

  5. Click "Start" inside Start the program modal. Start

  6. You will be prompted to set password. It should be secure enough.

  7. Close the modal or click "Close" button. Completed

  8. Inside BankID Secure Application you'll get new record about BankID connection. Security application

  9. Done. Now you can test login with BankID at Windows Desktop.

Connect with MacOS 💻

TODO

If you have a Macbook, you can help to document it with screenshots (Contributors welcome).