Jump to content

Recommended Posts

Trying to create an angular app to pull in both Twitch data and Extra Life donor data.  I'm getting the "No 'Access-Control-Allow-Origin' header is present on the requested" error when trying to make a request to Extra Life.  Is it possible to allow for jsonp requests or enable CORS?

Edited by heartandthesynapse

Share this post


Link to post
Share on other sites

Awesome thanks Sapience!

In case anyone wants to take a peak at what I'm working on you can find it running at http://warm-badlands-2006.herokuapp.com/#/.  Right now the only real feature is the Twitch overlay.  I just use X-Split to pull in the website and then display the data that way.  I plan to create an X-Split scene people can just download and use once it is all done.

If I can find a way to consume the Extra Life API (hopefully they can allow for JSONP requests) I'll be pulling in donor information and goals for the individual and their team.  Also I'm hosting it with a free service right now so I think it is only allowed to be up and running for 18 hours a day or something along those lines.  Closer to game day I'll actually invest in real hosting so people can use the app without running into any downtime.

Let me know what you think!

 

Screen-Shot-2015-09-11-at-8.52.47-AM.jpg

Share this post


Link to post
Share on other sites

Looks good!  I started exploring the JSON data as well, but encountered the jsonp/CORS issue about the same time you did.  Hopefully the team is able to make it work.

 

Assuming they are able to resolve it, would you be willing to share your code for the donor info?  I'm pretty new to javascript/jquery/json, but was able to find some good samples yesterday.  I was just thinking it would be a good starting point for me and anyone else looking to get started in putting something together for this.

Share this post


Link to post
Share on other sites

I'm also working on some widgets, and ran into the same CORS issue. My team got around it by creating a proxy server to pass GET requests through to Extra Life, but would really like it if we could access Extra Life's data directly.

Share this post


Link to post
Share on other sites

Looking at this from another perspective, you can pull the data using .NET (using the System.Net.WebClient class), but that takes the design in a completely different direction.  Still, I may pursue this for my own stream.

Share this post


Link to post
Share on other sites

I had updated my apps to use the jsonp.afeld.me proxy, but the site appears to be down right now.

It's be much simpler to be able to access the data directly from extra-life's site rather than having to set up a proxy server or jump through hoops like this. Is there any way the Extra Life team can enable CORS so that we can access our data?

Share this post


Link to post
Share on other sites

Looks like this request is dead, but I'll throw my support behind asking for it as well. I ended up needing to setup a proxy to actually use the API, which isn't ideal. Adding CORS support would be really helpful.

FYI if you do need to go this route, this solution isn't so bad, but you do have to depend on using someone elses proxy:

https://jsonp.afeld.me/

Share this post


Link to post
Share on other sites

I don't know if it was updated or not but I have been writing a NodeCG overlay for my stream day and recently I switched back over to the live data to see if it anything changed and sure enough I am no longer getting a cross-origin script error. Everything is loading for me fine now and the data is great! I don't know if this will help anyone or not but it is worth a shot to maybe try it again.

Share this post


Link to post
Share on other sites
On 10/17/2016 at 3:18 PM, vectorsigmasix said:

I just tried and I can confirm they've added CORS support. Thanks guys!

 

Awesome!  I haven't checked in so long.  I might resurrect some of my projects that I had been working on.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×