Creation and Authorisation of an AIS Consent in Steps
- Prerequisites
- Exclusions
- Step 1 Consent Creation
- Step 2 Consent authorisation initiation
- Step 3 Provide PSU password
- Step 4 Select SCA method
- Step 5 Provide 2nd factor
This article gives an example of creation and authorisation of a detailed consent that will give TPP an access to 2 different accounts of a single PSU.
Learn more about consent models 10. XS2A Consent Models and Access Rights.
In this example, embedded SCA approach is used. Learn more about SCA approaches that are supported in XS2A 02.XS2A - Embedded SCA Approach with Selection of SCA Methods.
Prerequisites
Your certificate must contain the PSP role = PSP_AI.
Exclusions
- one-time consents are not supported ("recurringIndicator": false).
- combined AIS and PIS sessions are not supported ("combinedServiceIndicator": true).
Step 1 Consent creation
On this step request to create a consent with consent data is sent to XS2A.
XS2A validates the role from the certificate, PSU-ID and request syntax. If all the validations have been completed successfully, XS2A returns a consentId.
It means that a consent resource has been created and must be authorised by PSU.
Created consent resource will be accessible under given consentId during 30 minutes from the moment of creation. Authorisation of given consent must be completed within this time.
If a consent is not authorised and its validity time is over the access to this resource will be cancelled and consent creation flow will be terminated.
Request
- Go to /v1/consents.
- Fill in mandatory data
- Method = POST
- PSU-ID = one of PSU-IDs from 09. Sandbox Test Accounts and Test Data
- X-Request-ID = valid UUID
- Fill in consent data according to the consent model
Example
{
"access": {
"balances": [
{ "iban": "DE52500105173911841934" },
{ "iban": "DE89370400440532013005" }
],
"transactions": [
{ "iban": "DE52500105173911841934" },
{ "iban": "DE89370400440532013005" }
]
},
"recurringIndicator": true,
"validUntil": "2019-12-28",
"frequencyPerDay": "4",
"combinedServiceIndicator": false
}
4. Execute the request.
Response
HTTP status code: 201 Created
Example
{ "consentStatus": "received",
"consentId": string,
"_links": { "startAuthorisation": "/v1/consents/{consentId}/authorisations" }
}
Step 2 Consent authorisation initiation
On this step consent authorisation is initiated.
XS2A validates the role from the certificate, consentId and request syntax. If all the validations have been completed successfully, XS2A returns an authorisationId inside the "updatePsuAuthentication" link.
It means that an authorisation sub-resource has been created for given consentId.
Created authorisation sub-resource will be accessible under given authorisationId during 30 minutes from the moment of creation. Authorisation of given consent must be completed within this time.
If a consent is not authorised and its validity time is over the access to this resource will be cancelled and consent creation flow will be terminated.
Request
- Go to /v1/consents/{consentId}/authorisations or follow the "startAuthorisation" link from the response in Step 1.
- Fill in mandatory data
- Method: POST
- PSU-ID: same as in Step 1
- X-Request-ID: valid UUID
- consentId: consentId received in response in Step 1
- body: no body
- Execute the request.
Response
HTTP status code: 200 Ok
Example
{
"scaStatus": "received",
"_links": {"updatePsuAuthentication": "/v1/consents/{consentId}/authorisations/{authorisationId}"}
}
Step 3 Provide PSU password
On this step PSU password must be provided.
Please, use correspondent password from 09. Sandbox Test Accounts and Test Data.
Request
- Go to /v1/consents/{consentId}/authorisations/{authorisationId} or follow the "updatePsuAuthentication" link from the response in Step 2.
- Fill in mandatory data
- Method: PUT
- PSU-ID: same as in Step 1
- X-Request-ID: valid UUID
- authorisationId: authorisationId received in response in Step 2
- consentId: consentId received in response in Step 1
-
Fill in psuData
Example
{
"psuData": {"password": "string"}
} - Execute the request.
Response
HTTP status code: 200 Ok
Example
{
"scaStatus": "psuAuthenticated",
"scaMethods": [
{
"authenticationType": "SMS_OTP",
"authenticationMethodId": "sms"
},
{
"authenticationType": "CHIP_OTP",
"authenticationMethodId": "chip"
}
],
"_links": {"selectAuthenticationMethod": "/v1/consents/{consentId}/authorisations/{authorisationId}",
"scaStatus": "/v1/consents/{consentId}/authorisations/{authorisationId}"}
}
Step 4 Select SCA method
PSU was authenticated successfully with its PSU-ID and password in the previous step and now XS2A offers selection of authentication methods.
An authentication method is a format of the 2nd factor that must be provided by PSU in order to complete the authorisation of a consent.
To trigger Decoupled SCA please use authenticationMethodId where "authenticationType" = "PUSH_OTP” in the response in the Step 3.
Request
- Go to /v1/consents/{consentId}/authorisations/{authorisationId} or follow the "selectAuthenticationMethod" link from the response in Step 3.
- Fill in mandatory data
- Method: PUT
- PSU-ID: same as in Step 1
- X-Request-ID: valid UUID
- authorisationId: authorisationId received in response in Step 2
- consentId: consentId received in response in Step 1
-
Fill in authenticationMethodId
Example
{
"authenticationMethodId": "chip"
} - Execute.
Response
HTTP status code: 200 Ok
Note: "authoriseTransaction" link will only be returned if EMBEDDED SCA has been chosen.
Example
{
"scaStatus": "scaMethodSelected",
"chosenScaMethod": {
"authenticationType": "CHIP_OTP",
"authenticationMethodId": "chip"
},
"_links": {"scaStatus": "/v1/consents/{consentId}/authorisations/{authorisationId}",
"authoriseTransaction": "/v1/consents/{consentId}/authorisations/{authorisationId}"}
}
Step 5 Provide 2nd factor
This is the final step where PSU completes consent authorisation by providing the 2nd factor (this is only applicable for EMBEDDED SCA approach).
In real-live operations, a bank will generate and send the 2nd factor to PSU.
In the Sandbox the behaviour of a bank is simulated: XS2A doesn't generate and sent any 2nd factors but offers default format of authentication data. Please, see 09. Sandbox Test Accounts and Test Data.
Request
- Go to /v1/consents/{consentId}/authorisations/{authorisationId} or follow the "authoriseTransaction" link from the response in Step 4.
- Fill in mandatory attributes
- Method: PUT
- PSU-ID: same as in Step 1
- X-Request-ID: valid UUID
- authorisationId: authorisationId received in response in Step 2
- consentId: consentId received in response in Step 1
-
Fill in scaAuthenticationData according to the authentication method selected in the previous step. Please, see 09. Sandbox Test Accounts and Test Data.
Example
{
"scaAuthenticationData": "string"
}
4. Execute the request.
Response
HTTP status code: 200 Ok
Example
{
"scaStatus": "finalised",
"_links": {"scaStatus": "/v1/consents/{consentId}/authorisations/{authorisationId}"}
}