To call an API with three-legged authentication, we first need the code that is used to obtain an access_token, and then we make the API call with the obtained access_token. This code is valid for a specific user and for a limited time.
Remember that you must have created an application in BBVA API_Market with an API that requires three-legged authentication available, such as Customers.
Get code needed to access_token. BBVA Connect
It is necessary that when calling these APIs, the Sandbox connect is previously invoked indicating the redirect_url field. In other words, the address the client returns to after authentication. Remember that you need to have that same address set up in your app.
You can check it in your app’s advanced settings.
As an example of redirect_url we suggest you use the following URL: https://static.bbvaapimarket.com/resources/retail/callback/index.html
First we call from the browser to the following URL: https://connect.bbva.com/sandboxconnect?client_id=APP_ID&response_type=code&redirect_uri=REDIRECT_URL
Where APP_ID is the id of the configured app (for example, app.bbva.Prod001) and REDIRECT_URL is the redirect_url configured in the advanced options of your application.
The browser will load the BBVA Connect screen where it will display the username and password of any of the Sandbox users. In the API documentation there are several test users/passwords, e.g.:
· Username: 00000034B
· Password: 123456
After entering a correct username and password, the Scopes acceptance screen will appear, authorizing the application for the required services.
The acceptance process ends by loading a page showing the code that you can copy directly. Note that this code expires after 30 seconds, so this is the time you have to obtain the access_token described in the following point.
Get access_token with the obtained code
To get the acces_token, we must access Postman and set up the call following the same steps described in the “Get access_token” section of this guide.
All we need to change is the URL:
URL: https://connect.bbva.com/token?grant_type=authorization_code&redirect_uri=REDIRECT_URL&code=CODIGO_OBTENIDO
Where REDIRECT_URL is the one we have configured in the application and CODE_OBTAINED is the code we have obtained in the previous point.
With the access_token obtained in the previous point, we set up a call in Postman with the following parameters:
· URL: https://apis.bbva.com/customers-sbx/v1/me-basic
· Method: GET
Headers:
· Authorization: jwt ACCESS_TOKEN
· Accept: application/json
{ "access_token": "eyJhbGciOiJSU0EtT0FFUCIsInppcCI6IkRFRiIsImVuYyI6IkExMjhHQ00ifQ.TI2wrGU73CKqLpQv-reFkDBx_rhBlvJ_Mqe4D5TDqGetVvX-sXdL0ghj3USaEkgc880pWONDxI68inv89sMF6OOErs5Fj-xNwwyO5MR1l0nXG10Apsp7PXX34YFZU-QiqDZL9db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Bqd2QqAlnBeHL5-8nMO1lN4r4lu-jY2ELhcGKvF-QkOBjc_TsJg.Mw6InT_Q126l61R3.mrPMmmKBLTLnkmx0BFl76ylzQ3rAf6nzRYdM3sBM-v_S-v2ZcC0yL0_fmM-u1GrQWp_5W0UA4EBSxo0mUMyM26OCqSfG96o5o31fVDErn7DdYMfPnFyXjLB8gBVcLoqxjDj0iJz0wnYe-PvmTLFKZGqGXn7G5wAK5D5ZoUrx9I5o1_LkGNTnL4ZUtrG76x1JfFPosER-Bku7Uoy84l_SjlB1KSOk93DPFBBSAv7cpLte06CiZ41KvgmM_nk950dLV7hsuFhy9w7AA7PKtfYfrGXjWnY1eHj7Eo0Uhb9ZUpcOnnZpZyRmBtmeIlcigCkC9CInnFSilOTO39cIhl-VGT4Jlymtf1yLCYVyDF6KXUCRoZMFeT_M_8K03GD6wJ0uj23kLK01yLxTuz9tm05p4wo8wjFtvs5y_J-ixdTaPC5ir-W-ZfGJ--RoY5zfKqSGzgG1mtYERK3DvVzM0wRYXqz1FhzpvnqBtp81rLaAmNDiVAGJq6t5jan3kPSftwuLfQFmwAGU-fttxmA1ALzPXyFFO1hmjdOayKVHSz2IUtVDoPN9YLJjf8j4LAUhI5ZSJEM.qNWCMNovgd0l_E1DmV3Jfw", "expires_in": 3599, "scope": "card-notifications-sbx_full paymentsTransfersList_sbx accounts_detail_full_sbx_1 paystats_sbx_test paymentsTransfer_execution_sbx_1 cardsV2_detail_full_sbx_1 loanpreapprovedsimulation_sbx card_transactions_sbx atms_sbx cards_detail_basic_sbx_2 data_manager_sbx loanpreapproved_sbx event-generator-sbx_full notifications-sbx_full paymentsTransferOrders_execution_sbx_1 paymentsTransfersMobileCash_sbx account_transactions_sbx customers_full_sbx_1", "refresh_expires_in": 43199 }
Revocation of Authorizations
To revoke the authorizations (access_token) obtained in the previous point through BBVA connect mx, configure a call in Postman, using the DELETE method, with the following parameters:
· URL: https://connect.bbvabancomer.com/authorizations
· Method: DELETE
Headers:
· Authorization: jwt ACCESS_TOKEN
This endpoint revokes authorizations (access_token) for sandbox and live environments.