Environments#
The BankID module supports three operating environments: Mock, Test, and Production. Configure the active environment under Configuration > System > BankID Settings (/admin/config/system/bankid).
1. Mock Environment#
The Mock environment is designed for local development, automated testing, and CI pipelines without requiring SSL certificates or internet connectivity to BankID servers.
- No Certificates Needed: Bypasses mTLS validation and Key repository requirements.
- Simulated Order States: Generates local mock tokens and simulates the BankID QR code flow.
- Interactive Test Form: When the BankID dialog opens, a mock control form is presented alongside the QR code:
- Enter any Swedish Personal Identity Number (SSN), Given Name, and Surname to test successful completion.
- Test edge cases and error states by triggering simulated outcomes such as
cancel,expired, orcertificate_error.
2. Test Environment#
The Test environment connects to BankID's official pre-production API (https://appapi2.test.bankid.com/rp/v6.0/).
- Follow the official guide on Test BankID and create a BankID for test.
- Generate a test personal number from the Swedish Tax Agency (Skatteverket).
- The test environment comes pre-configured with default test keys in the module's
assets/directory (FPTestcert5_20240610.p12and test CA certificate), which are imported automatically upon module installation.
3. Production Environment#
The Production environment connects to the live BankID service (https://appapi2.bankid.com/rp/v6.0/).
- Order production Relying Party (RP) certificates from your bank according to the BankID Technical Integration Guide.
- Store the certificates in a secure directory outside of the web root on your server.
- Use the Key module (
/admin/config/system/keys/add) to register keys using theFileKeyProvider: - RP Certificate: Path to your
.p12or.pemcertificate. - RP Passphrase: Passphrase for the certificate key.
- Server CA Certificate: The issuer certificate (
test_cacert.ceror BankID production root CA). - In BankID Settings (
/admin/config/system/bankid), select the corresponding keys under the Production fieldset.