ebay-api icon indicating copy to clipboard operation
ebay-api copied to clipboard

commerce.catalog > invalid scope

Open shopeandodev opened this issue 4 years ago • 17 comments

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

shopeandodev avatar Dec 01 '21 22:12 shopeandodev

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.

dantio avatar Dec 03 '21 12:12 dantio

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?

shopeandodev avatar Dec 03 '21 17:12 shopeandodev

@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.

dantio avatar Dec 04 '21 12:12 dantio

@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

shopeandodev avatar Dec 06 '21 15:12 shopeandodev

Can you show me all scopes that you are using?

dantio avatar Dec 07 '21 18:12 dantio

@dantio image

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

shopeandodev avatar Dec 07 '21 19:12 shopeandodev

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.

dantio avatar Dec 08 '21 09:12 dantio

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',

shopeandodev avatar Dec 08 '21 14:12 shopeandodev

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.

dantio avatar Dec 08 '21 15:12 dantio

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

Im using the US marketplace

shopeandodev avatar Dec 08 '21 15:12 shopeandodev

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

dantio avatar Dec 08 '21 16:12 dantio

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 avatar Dec 08 '21 16:12 shopeandodev

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

shopeandodev avatar Dec 08 '21 16:12 shopeandodev

@shopeandodev hey did you managed to call API?

dantio avatar Dec 14 '21 20:12 dantio

@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

shopeandodev avatar Dec 16 '21 15:12 shopeandodev

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', ])

okalBB avatar Feb 04 '23 02:02 okalBB