Integration
- Create a new MAS transaction via
POST /mas/new, providing:masOptions(required) — an array of one or more options, each specifying aprovider,method, and a uniqueid. The end-user will be presented with these options to choose from.redirectUrl(required) — the URL the end-user is redirected to after completing the transaction.skipSingleOption(optional, defaulttrue) — when set totrue, the selection screen is skipped automatically if only one option is provided.
- From the response, extract
accessUrlandid. Send the end user toaccessUrl. It can be opened in a popup or redirected to. Embedding in an iframe is not allowed. The end-user picks a provider from the MAS selection screen and completes authentication. - Once authentication is complete, the end-user is redirected to
redirectUrl. Query transaction completion data viaGET /mas/{transaction_id}, wheretransaction_idis theidfrom step 1. UseGET /mas/{transaction_id}/fullto retrieve the transaction along with all associated metadata.
info
Unlike a standard transaction accessUrl, the MAS accessUrl is long-lived and remains valid for 30 days as long as it has not been opened. Once the end-user visits it, the URL is consumed and cannot be reused.
Cancellation
A MAS transaction can be cancelled via POST /mas/{transaction_id}/cancel.
- Any transaction with status
newcan be cancelled (before it has been started). - Only Swedish BankID and Freja transactions can be cancelled after they have been started.
- Transactions that have reached
completeorfailedcannot be cancelled.
After completion
Once the end-user completes authentication, they are redirected to your redirectUrl with two query parameters appended:
transaction_id— the MAS transaction IDsuccess—trueorfalse
If your redirectUrl contains a URL fragment, the parameters are appended to the fragment instead of the query string.