Viva Wallet - Outh2 Authetication

Hi, I’mm trying to connect Viva Wallet payment to my app through The Api Connector. I am having trouble requesting access token through Oauth2 authentication. Has anyone worked on this before? Yet I believe I follow the documentation carefully.

https://developer.viva.com/apis-for-payments/payment-api/#section/SandBox

https://developer.viva.com/smart-checkout/smart-checkout-integration/

You should use Custom oauth2 authentication.

Do you mean Oauth custom token? Can you show me an example?

Start to fill it and post a screenshot. We will be able to help. Each API is different.
In this case, you should have two headers for token call: Authorization and Content-type
Content-Type: application/x-www-form-urlencod Authorization: Basic yourbasicauth
Url: https://demo-accounts.vivapayments.com/connect/token for sandbox
and in body, you can set grant_type=client_credentials
After, test with a simple get request like: https://demo-api.vivapayments.com/merchants/v1/wallets

https://developer.viva.com/integration-reference/oauth2-authentication/

No… you didn’t use authentication: custom oauth2

Did you initialize the API call for wallets? Any error?

There was an issue setting up your call.

The service this service just returned an error (HTTP 400). Please consult their documentation to ensure your call is setup properly. Raw error:

{"error":"invalid_request"}

400 is not an issue related to authentication normally.
Url seem good and there’s no parameters for this endpoint.

Just to validate the token request is working, you can create requestbin (or similar http request testing tool) endpoint, use the url to test and inspect the headers call

You can test with a different endpoint too like
https://demo-api.vivapayments.com/banktransfers/v1/bankaccounts

I’m trying with requestbin and the request doesn’t arrive. I’m not sure if I set it up correctly

I just created a requestbin and pasted the url into bubble

Once it’s done, click initialize it and you should see it in requestbin (however, the new requestbin version is not very intuitive. webhook.site and beeceptor are good alternatives (but there’s a lot more)
If you see authorization header with Bearer and an access token, this mean auth is working

I clicked initialize and then I check this panel

I tried also with beeceptor

Do you get 400 error in Bubble again?

yes, the same

Ok so the error ome from the token request that is not correctly sent. Try to move the body directly in url with ?grant_type=client_credentials in it

It doesn’t work. I think I found the solution. In this way works, I riceved the correct response.