GithubHelp home page GithubHelp logo

Comments (11)

dantio avatar dantio commented on May 20, 2024

You have to use a proxy since you are using it from the browser. Take a look in browser examples and here https://hendt.github.io/ebay-api/

from ebay-api.

muhammed671 avatar muhammed671 commented on May 20, 2024

Thanks for the feedback

It's solved. I put this config (only for testing):

eBay.req.instance.interceptors.request.use((request) => {
  request.url = 'https://ebay.hendt.workers.dev/' + request.url;
  return request;
});

But now I have Accept-Encoding error:

image

This is my header:

  private httpOptions = {
    headers: new HttpHeaders({ 
      'Authorization': 'Basic ' + btoa(appId + ':' + certId),
      'Accept': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Accept-Encoding': 'gzip',
      'Content-Encoding': 'gzip'
    })
  };

How I can solve this problem?

from ebay-api.

dantio avatar dantio commented on May 20, 2024

Why do set the headers? It's not required. Just take a look in the source code of the page I posted.

from ebay-api.

muhammed671 avatar muhammed671 commented on May 20, 2024

That's my full configuration. But same issiue with "Accept-Encoding"

import  eBayApi  from '@hendt/ebay-api';

const eBay = new eBayApi({
  appId: appId,
  certId: certId,
  sandbox: false,
});

eBay.req.instance.interceptors.request.use((request) => {
  // Add Proxy
  request.url = 'https://ebay.hendt.workers.dev/' + request.url;
  return request;
});

eBay.commerce.taxonomy.getCategoryTree('77').then(data=>console.log(data))

from ebay-api.

dantio avatar dantio commented on May 20, 2024
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@hendt/ebay-api@latest/lib/ebay-api.min.js"></script>
</head>
<body>
<script>
  
const eBay = new eBayApi({
  appId: '-',
  certId: '-'',
  sandbox: false,
});
  
eBay.req.instance.interceptors.request.use((request) => {
  request.url = 'https://ebay.hendt.workers.dev/' + request.url;
  return request;
});
  
  eBay.commerce.taxonomy.getCategoryTree('77').then(data=>console.log(data))
  </script>
</body>
</html>

Tested with Chrome and FF. Both works for me.

from ebay-api.

dantio avatar dantio commented on May 20, 2024

I'm able to reproduce the error now. I'm on it.

from ebay-api.

dantio avatar dantio commented on May 20, 2024

@muhammed671 v5.0.3 should fix this issue.

from ebay-api.

muhammed671 avatar muhammed671 commented on May 20, 2024

Thanks for fixing. In my local test envairment it looks good. Next step, needs to check it in production on the server with my own proxy.

I will let you know about the result.

from ebay-api.

muhammed671 avatar muhammed671 commented on May 20, 2024

It works also on production with own proxy.

Used Proxy Server:
https://github.com/Rob--W/cors-anywhere

@dantio Thanks for support and fixing the issue

from ebay-api.

dantio avatar dantio commented on May 20, 2024

Nice! Thank you, I'll add cors-anywhere to docs also.

from ebay-api.

muhammed671 avatar muhammed671 commented on May 20, 2024

Nice! Thank you, I'll add cors-anywhere to docs also.

Only for your Docs. The Proxy from Rob--W/cors-anywhere works very well with heroku.com

from ebay-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.