Skip to content

Bug: Token from 'refreshAuthToken' event lacks permissions for Business Policies #203

@evers-hamza

Description

@evers-hamza

When the ebay-api client automatically refreshes the OAuth2 token (via the autoRefreshToken: true configuration), the new token emitted in the refreshAuthToken callback appears to have restricted permissions. Specifically, it fails to fetch Business Policies, resulting in unauthorized/permission errors. However, creating a new token manually via the eBay Auth API using the same credentials and scopes works perfectly.

To Reproduce

Initialize the eBay client with autoRefreshToken: true.

Wait for the initial token to expire (2 hours).

Catch the new token in the event listener:

client.OAuth2.on('refreshAuthToken', async (newToken) => {
    // Use this newToken to call Business Policy APIs (e.g., Account API)
});

Observe that API calls to Business Policies fail with this newToken.

Manually request a token using the same refresh token/scopes via a separate API call—this manual token works.

Expected behavior The newToken provided by the refreshAuthToken event should be functionally identical to a manually refreshed token and should maintain all scopes (including those required for Business Policies/Account API) granted during the initial user consent.

- API Scopes Used

  1. https://api.ebay.com/oauth/api_scope,
  2. https://api.ebay.com/oauth/api_scope/sell.marketing.readonly,
  3. https://api.ebay.com/oauth/api_scope/sell.marketing,
  4. https://api.ebay.com/oauth/api_scope/sell.inventory.readonly,
  5. https://api.ebay.com/oauth/api_scope/sell.inventory,
  6. https://api.ebay.com/oauth/api_scope/sell.account.readonly,
  7. https://api.ebay.com/oauth/api_scope/sell.account,
  8. https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly,
  9. https://api.ebay.com/oauth/api_scope/sell.fulfillment,
  10. https://api.ebay.com/oauth/api_scope/sell.analytics.readonly,
  11. https://api.ebay.com/oauth/api_scope/sell.finances,
  12. https://api.ebay.com/oauth/api_scope/commerce.notification.subscription,
  13. https://api.ebay.com/oauth/api_scope/commerce.notification.subscription.readonly,
  14. https://api.ebay.com/oauth/api_scope/sell.marketplace.insights.readonly,
  15. https://api.ebay.com/oauth/api_scope/sell.item.draft,
  16. https://api.ebay.com/oauth/api_scope/sell.item

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions