VivaPayments / API

Index of Viva Wallet open source projects on GitHub.
139 stars 163 forks source link

Invalid scope issue #2456

Closed fasetto closed 10 months ago

fasetto commented 10 months ago

Hi,

When I try to get a token from the api, it throws Error: invalid_scope error.

Example request:

curl -L "https://demo-accounts.vivapayments.com/connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Authorization: Basic  TOKEN_HERE" \
-d "grant_type=client_credentials" \
-d "scope=urn%3Aviva%3Apayments%3Acore%3Aapi%3Aacquiring%20urn%3Aviva%3Apayments%3Acore%3Aapi%3Aacquiring%3Acardtokenization%20urn%3Aviva%3Apayments%3Acore%3Aapi%3Aacquiring%3Atransactions%20urn%3Aviva%3Apayments%3Acore%3Aapi%3Aredirectcheckout%20urn%3Aviva%3Apayments%3Acore%3Aapi%3Aplatform"

scopes I am trying to use;

urn:viva:payments:core:api:acquiring 
urn:viva:payments:core:api:acquiring:cardtokenization 
urn:viva:payments:core:api:acquiring:transactions 
urn:viva:payments:core:api:redirectcheckout 
urn:viva:payments:core:api:platform

I am trying to use "create connected account" api. I got these scopes from the documentation here I am getting invalid scope error.

If I remove this scope urn:viva:payments:core:api:platform it works. But Create connected account api throws 403 this time. I need your help to solve this.

VivaWalletCustomerSupport commented 10 months ago

Hello @fasetto,

Thank you for your message. Are you trying to use the "Create Connected Account" API request in a demo or live environment?

Kind regards, Viva Wallet E-commerce Support Team

fasetto commented 10 months ago

Yes, I am trying to use "Create Connected Account" API. Demo environment.

VivaWalletCustomerSupport commented 10 months ago

Hello @fasetto,

Thank you for the information. In order to use the "Create Connected Account" API you should follow the steps below:

  1. Firstly, as the marketplace owner, you should sign up for a Viva Wallet account - this will be your platform account
  2. Then, provide your account details (such as the phone number used for sign-up) to Viva Wallet via your Sales representative or via the Live Chat option (which can be found at the bottom-right of the Developer Portal and main Viva Wallet site, or in your Production Viva Wallet self-care account)
  3. Viva Wallet will configure your platform account and provide you with the relevant credentials
  4. Once the platform account is ready, you need to connect it with a marketplace owner account. To do this, use the provided platform account credentials with the Create a connected account API, noting the accountId provided in the response (do not follow the redirectUrl, as this is not functional in the Demo environment): -If creating a new account, you will need to input this accountId in the ‘Connected account id’ field when signing up for an account -If linking an existing account, you will need to provide this accountId to Viva Wallet to connect the accounts

Kind regards, Viva Wallet E-commerce Support Team

fasetto commented 10 months ago

@VivaWalletCustomerSupport I think you misunderstood me. I am trying to use the "Create Connected Account" api. But I can not use it. Because I don't have a valid token. Read issue description please. I am trying to generate an auth token. But service gives scope error.

VivaWalletCustomerSupport commented 10 months ago

Hello @fasetto,

Thank you for the reply. Kindly note that the "Create Connected Account" API is available only for Marketplace accounts. If you wish to use it, you should follow the instructions we mentioned above. More information about the Marketplaces can be found here.

Kind regards, Viva Wallet E-commerce Support Team

fasetto commented 10 months ago

@VivaWalletCustomerSupport I already read the documentation. The documentation doesn't say how to create a marketplace account. I already have the platform account?

  1. So, how can I create it?
  2. Why the api is throwing scope error?

Please tell me about these.

VivaWalletCustomerSupport commented 10 months ago

Hello @fasetto,

Thank you for your reply. We would like to inform you that if you wish to create a Marketplace account in demo environment you should follow the steps below:

  1. Firstly, as the marketplace owner, you should sign up for a Viva Wallet account this will be your platform account
  2. Then, provide your account details (such as the phone number used for sign-up) to Viva Wallet via your Sales representative or via the Live Chat option (which can be found at the bottom-right of the Developer Portal and main Viva Wallet site, or in your Production Viva Wallet self-care account)
  3. Viva Wallet will configure your platform account and provide you with the relevant credentials
  4. Once the platform account is ready, you need to connect it with a marketplace owner account. To do this, use the provided platform account credentials with the Create a connected account API, noting the accountId provided in the response (do not follow the redirectUrl, as this is not functional in the Demo environment): -If creating a new account, you will need to input this accountId in the ‘Connected account id’ field when signing up for an account -If linking an existing account, you will need to provide this accountId to Viva Wallet to connect the accounts

About the scope error, it returns an error because the steps above are not completed. After step 3 we will send you the relevant credentials for "Create Connected Account" API request.

Kind regards, Viva Wallet E-commerce Support Team