1

Anyone else having this issue with themoviedb api?

XMLHttpRequest cannot load http://api.themoviedb.org/3/search/tv?api_key=XXX&query=mr.%20robot. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://van-der-noord.nl' is therefore not allowed access.

I'm pretty sure this use to work without having te set chrome's cross domain policy.

Any idea?

vanzylv
  • 761
  • 2
  • 8
  • 21
  • looking at how https://github.com/cavestri/themoviedb-javascript-library/blob/master/themoviedb.js does it, it seems that the content-type headers might trigger the cors headers... – dandavis Jan 19 '16 at 06:24

3 Answers3

1

You'll probably want to add a callback parameter:

http://api.themoviedb.org/3/search/tv?api_key=XXX&query=mr.%20robot&callback=test

And then call that however Angular expects JSONP callbacks to be used.

Travis Bell
  • 174
  • 6
0

Try to install Google Chrome extension Allow-Control-Allow-Origin: Maybe it helps

Wasiq Muhammad
  • 2,770
  • 3
  • 14
  • 26
0

This error caused by CORS

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

But this solutions only works for you. If you need work this on every computer you need to setup some kinda proxy file, or you can use JSONP version.

http://docs.themoviedb.apiary.io/#reference

Unlike previous versions of the API, v3 only supports a single format, JSON. XML and YAML support are being officially dropped. JSONP is also officially supported, just add a callback parameter to your request and the response will be encapsulated in the value you specified.

Since you need to use API key to fetch information, i suggest you to use proxy file to get it for you.

Community
  • 1
  • 1
Anakin
  • 2,710
  • 4
  • 19
  • 12