Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commerce.catalog > invalid scope #99

Open
shopeandodev opened this issue Dec 1, 2021 · 16 comments
Open

commerce.catalog > invalid scope #99

shopeandodev opened this issue Dec 1, 2021 · 16 comments

Comments

@shopeandodev
Copy link

Hi, thanks for this library.

I have a problem, when i try to use your library in production mode, and try to use the scope
https://api.ebay.com/oauth/api_scope/commerce.catalog.readonly

and then when try to enter to the auth url, i got the error in the redirect url:
https://signin.ebay.com/ws/eBayISAPI.dll?ThirdPartyAuthSucessFailure&isAuthSuccessful=true&error=**invalid_scope**

how can i use the api catalog in production (not sandbox)

thanks in advance

@dantio
Copy link
Collaborator

dantio commented Dec 3, 2021

Which API do you want to call?
Check if your App is granted to use this scope. Visit https://developer.ebay.com/my/keys and click on "OAuth Scopes" below productions keys.
In the modal window you will see all the scopes you can use.

@shopeandodev
Copy link
Author

shopeandodev commented Dec 3, 2021

hi @dantio , thanks for reply.

now i see, this scope ( https://api.ebay.com/oauth/api_scope/commerce.catalog.readonly ) only appears in the sandbox oauth scopes, and i was triing in production mode.

Now, when i test this on sandbox, and i try to get a product i got the next error:

EBayError: The specified EPID value 313642744618 was not found.
    at handleEBayError (/home/shopea6/public_html/shopeando.mx/ends/tests/ebapi/node_modules/@hendt/ebay-api/lib/errors/index.js:186:11)
    at Catalog.request (/home/mypath/ebapi/node_modules/@hendt/ebay-api/lib/api/restful/index.js:160:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Catalog.doRequest (/home/mypath/ebapi/node_modules/@hendt/ebay-api/lib/api/restful/index.js:127:20)
    at async a (/home/shopea6/public_html/mypath/ebapi/controllers/test.controller.js:34:26) {
  description: 'Not Found',
  meta: {
    errorId: 75010,
    domain: 'API_CATALOG',
    category: 'REQUEST',
    message: 'The specified EPID value 313642744618 was not found.',
    parameters: [ { name: 'epid', value: '313642744618' } ],
    res: {
      status: 404,
      statusText: 'Not Found',
....

and the epid (313642744618) exists on ebay-us. is this error is common on sandbox?

do you know how can i get this scope on production mode?

@dantio
Copy link
Collaborator

dantio commented Dec 4, 2021

@shopeandodev the eBay sandbox has only limited static data. I would try it with production and add https://api.ebay.com/oauth/api_scope/sell.inventory to the scope.

@shopeandodev
Copy link
Author

@dantio i added that scope to the list, and try to get product info by catalog and got the next error:

  meta: {
    errorId: 75015,
    domain: 'API_CATALOG',
    category: 'REQUEST',
    message: 'Insufficient permissions to fulfill the request.',
    res: {
      status: 403,
      statusText: 'Forbidden',
      headers: {

Do you know how can i get access to the scope : https://api.ebay.com/oauth/api_scope/commerce.catalog.readonly

@dantio
Copy link
Collaborator

dantio commented Dec 7, 2021

Can you show me all scopes that you are using?

@shopeandodev
Copy link
Author

shopeandodev commented Dec 7, 2021

@dantio
image

i commented the last scope, because if i send it i got the error: invalid scope

@dantio
Copy link
Collaborator

dantio commented Dec 8, 2021

Do you set the correct scope in the auth process? This is important.

The fastest way to test it:

  1. https://developer.ebay.com/my/auth?env=production&index=0&auth_type=oauth
  2. click on "Sign in to Production"
  3. Copy the long generated access token
  4. eBay.OAuth2.setCredentials('paste the access token here');
  5. Call the catalog api

Now you should have "all" available scopes.

@shopeandodev
Copy link
Author

i got the next message:

  description: 'Forbidden',
  meta: {
    errorId: 75015,
    domain: 'API_CATALOG',
    category: 'REQUEST',
    message: 'Insufficient permissions to fulfill the request.',
    res: {
      status: 403,
      statusText: 'Forbidden',

@dantio
Copy link
Collaborator

dantio commented Dec 8, 2021

Did you use the access token from eBay directly? Which marketplace are using?

Currently the Catalog API is supported in the US, GB, AU, and CA (en) marketplaces.

@shopeandodev
Copy link
Author

@dantio yes Im using the token direct from eBay as you said me in the previous steps

Im using the US marketplace

@dantio
Copy link
Collaborator

dantio commented Dec 8, 2021

You are calling it like this?

eBay.OAuth2.setCredentials('ACCESS TOKEN');
eBay.commerce.catalog.getProduct('240206279')
  .then(result => {
    console.log(JSON.stringify(result, null, 2));
  })
  .catch(e => {
    console.log(e);
  });

I see insufficient permissions only if the access token is not set.

Try the API Explorer also:
https://developer.ebay.com/my/api_test_tool?index=0&api=catalog&call=product-epid__GET&variation=json&env=production

@shopeandodev
Copy link
Author

i got the next error on the Api Explorer:

{
  "errors": [
    {
      "errorId": 75015,
      "domain": "API_CATALOG",
      "category": "REQUEST",
      "message": "Insufficient permissions to fulfill the request."
    }
  ]
}

@shopeandodev
Copy link
Author

@dantio i send you an email with more details, thanks

@dantio
Copy link
Collaborator

dantio commented Dec 14, 2021

@shopeandodev hey did you managed to call API?

@shopeandodev
Copy link
Author

@dantio no yet, it seems i not have the enough scopes.

In the eBay forums someone told me i need to send my app to be checked by ebay support, but i need to pay premium support and waste my limit api calls by day to apply

@okalBB
Copy link

okalBB commented Feb 4, 2023

i had the same issue, i believe it is to do with the ruName , once i added that to my configs ebay stopped fetching .buy.browse.getItem , so i created a second with same details less ruName and it worked , now i have 2 sets one for buy and the other for the rest

import eBayApi from 'ebay-api'
import dotenv from 'dotenv'

dotenv.config()

export const eBay2 = new eBayApi({
appId: process.env.EBAY_APP_ID,
certId: process.env.EBAY_CERT_ID,
sandbox: false,
siteId: eBayApi.SiteId.EBAY_AU,
marketplaceId: eBayApi.MarketplaceId.EBAY_AU,
})

export const eBay = new eBayApi({
appId: process.env.EBAY_APP_ID,
certId: process.env.EBAY_CERT_ID,
devId: process.env.EBAY_DEV_ID,
ruName: process.env.EBAY_RU_NAME,
sandbox: process.env.EBAY_SANDBOX === 'true',
siteId: eBayApi.SiteId.EBAY_AU,
marketplaceId: eBayApi.MarketplaceId.EBAY_AU,

})

eBay.OAuth2.setScope([
'https://api.ebay.com/oauth/api_scope',
'https://api.ebay.com/oauth/api_scope/sell.marketing.readonly',
'https://api.ebay.com/oauth/api_scope/sell.marketing',
'https://api.ebay.com/oauth/api_scope/sell.inventory.readonly',
'https://api.ebay.com/oauth/api_scope/sell.inventory',
'https://api.ebay.com/oauth/api_scope/sell.account.readonly',
'https://api.ebay.com/oauth/api_scope/sell.account',
'https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly',
'https://api.ebay.com/oauth/api_scope/sell.fulfillment',
'https://api.ebay.com/oauth/api_scope/sell.analytics.readonly',
'https://api.ebay.com/oauth/api_scope/sell.finances',
'https://api.ebay.com/oauth/api_scope/sell.payment.dispute',
'https://api.ebay.com/oauth/api_scope/commerce.identity.readonly',
'https://api.ebay.com/oauth/api_scope/commerce.notification.subscription',
'https://api.ebay.com/oauth/api_scope/commerce.notification.subscription.readonly',
])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants