OTP (you can read more about this term and other technical concepts in our glossary) is an acronym for a one-time password. This password is generated to validate an action and will only be valid for that action. In this section we clearly summarize, using an example, the steps to follow in order to make a transfer through an API that requires an OTP.
Get code needed to access_token. BBVA Connect
We need to follow the steps indicated in this guide in the “Obtain code needed to order access_token BBVA Connect” and “Obtain access_token with the code obtained” sections. In the first section we’ll get a code, in the second section that code is used to get the access_token.
First API call
We make a first call to the Customers API (within Customers we use Me Full as an example). In this call we use the access_token obtained in the previous point as a parameter of the headers.
We set up the call in Postman:
· URL: https://apis.bbva.com/customers-sbx/v1/me-full
· Method: GET
Headers:
· Authorization: jwt access_token
· Accept: application/json
· Content-Type: application/json
This call returns a json with a 428 response type, with the information “Second factor required”, a ticket that we use in the next section and a new token that we call token_2.
Validate token_2
We have to validate the token that we obtained in the previous step. This token is the OTP key, and it is used to validate the transaction that we defined in the previous call.
To validate the token_2 we access the browser and enter the following URL:
https://connect.bbva.com/otp?ticket=TICKET&back_url=OTP_URL
Within this URL we replace the following fields:
· TICKET: we enter the ticket code we have in the previous Postman.
· OTP_URL: we have to use the OTP URL that is configured in the application we have created in the Quickstart guide.
The browser response to this URL is a screen that explains what the API is intended to do, in this case, get the full information about a bank customer. The user would receive an SMS with a verification code that should be entered in the field provided. As we are in a test environment, no SMS is sent and any value of 4 numbers entered in the field is accepted.
Once the code is sent, we will see the browser response in the URL. We will see the OTP URL with the ticket we have entered and the result of the Query: http:s3-eu-west-1.amazonaws.com/openp-clientapi-prod-eu-west-1/public/callback/index.html?ticket=TICKET&result=OK
Second API call
After validating token_2, we use it to make the second API call. In this case, we repeat the same operation described in the First API Call section, but using token_2 instead of the access_token.
· URL: https://apis.bbva.com/customers-sbx/v1/me-full
· Method: GET
Headers:
· Authorization: jwt token_2
· Accept: application/json
· Content-Type: application/json
When the call succeeds, the result is a json with code 201 200 indicating that data collection was successful.
{"result": {"code": 200,"info": "OK"},"data": {"firstName": "Carmen","surname": "Rodriguez","secondSurname": "Rodriguez","sex": "FEMALE","birthdate": "1970-08-19","email": "caop@mailinator.com","userId": "930ffbcb6be59758990076c356ecb88694ffcacaa7047383e6c0ea565b600a12","addresses": [{"id": "00001","zipcode": "28001"}],"identityDocument": [{"type": "NATIONALID","number": "000000034B"}]}}