0

I am trying to learn Angular by developing a website and I am getting the following error when I am trying to HTTP get my Github contributions from Github and showing them on the website.

Failed to load https://github.com/users/kapil5harma/contributions: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://kapil5harma.netlify.com' is therefore not allowed access.

I am able to see it working on my local using CORS plugin for Chrome, but when the same code is deployed on the website, it is throwing the error mentioned above.

Kapil Sharma
  • 141
  • 1
  • 15

1 Answers1

0

Github has its own dedicated API endpoints that serve the data you try to get. Check out the Github API documentation for more info.

Jens Habegger
  • 5,266
  • 41
  • 57
  • I am looking into API documentation, but I cannot find anything related to getting contributions SVG for a particular user. – Kapil Sharma Apr 30 '18 at 07:19
  • Is it possible to get contributions SVG image from Github API? – Kapil Sharma Apr 30 '18 at 07:23
  • If it's not listed in https://developer.github.com/v3/users/#get-a-single-user, it is very unlikely that that specific information is available. – Jens Habegger Apr 30 '18 at 07:51
  • I checked it in docs plus I actually fetched data from their API, but it does not contain what I need. – Kapil Sharma Apr 30 '18 at 09:15
  • In that case you're pretty much out of luck. You could still ask GitHub to extend their API to include the resources you'd like to access. – Jens Habegger Apr 30 '18 at 09:31
  • Thanks for the idea, I have already emailed their support service asking for help. If not resolved, I would ask them for what you suggested. :) – Kapil Sharma Apr 30 '18 at 09:42