Authentication
Note: this tutorial is only dedicated to point out which API methods should be used in order to correctly implement our Mobile SDK. Full API docs can be found at docs.kevin.eu
If you only plan to use one time payments, you don't need to implement authentication to achieve it.

Getting authentication state

For the account linking which you might use later for AIS or PIS services, you will need to get a state. Asking a user to authenticate within his account will allow you to skip authentication steps when initiating a payment and even skip low value payment SCA steps on some certain banks.
API method structure can be found here.
Example using our PHP library:
1
$client = new Client($id, $secret, ['version' => '0.3', 'error' => 'array']);
2
$attrs = [
3
'redirectPreferred' => 'false',
4
'scopes' => 'payments', // multiple scopes can be added separated with comma
5
'email' => '[email protected]',
6
'Request-Id' => uniqid(),
7
'Redirect-URL' => 'https://your.callback.url' // must match SDK callback url
8
];
9
$response = json_encode($client->auth()->authenticate($attrs));
Copied!
Received state value should be passed to the SDK when attempting to link the account.

Getting authentication tokens

After the user has successfully linked the account, the Mobile SDK will return a callback with authorizationCode, which can be used to fetch the tokens required for further work with AIS and PIS services.
API method structure can be found here.
Example using our PHP library:
1
$client = new Client($id, $secret, ['version' => '0.3', 'error' => 'array']);
2
$attrs = [
3
'grantType' => 'authorizationCode',
4
'code' => 'received-authorization-code-from-Mobile-SDK'
5
];
6
$response = json_encode($client->auth()->receiveToken($attrs));
Copied!
Make sure to save received refresh and access tokens for the further use.

Refreshing authentication tokens

Account access tokens have only a limited duration, so we recommend implementing a token refresh mechanism.
API method structure can be found here.
Example using our PHP library:
1
$client = new Client($id, $secret, ['version' => '0.3', 'error' => 'array']);
2
$attrs = [
3
'grantType' => 'refreshToken',
4
'refreshToken' => 'your-refresh-token'
5
];
6
$response = json_encode($client->auth()->refreshToken($attrs));
Copied!