The Movie Database Support

Bonjour, Je m’entraîne à utiliser l'API de movie DB dans le cadre de mes études. Mais j'ai un problème d’accès :

Access to XMLHttpRequest at '' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 

Il semblerait que je sois bloqué par CORS policy, je ne comprends pas trop d'où vient le problème.

Voici une partie de mon code :

const API_URL = "";

class App extends Component {
    constructor(props) {
        this.state = {}

    componentWillMount() {
        console.log('', response);
        //        ${POPULAR_MOVIES_URL}&${API_KEY}

Alors que quand je met cet url :

const test = ""

cela marche, et je n'ai pas ce genre d'erreur :/

Quelqu'un peut-il m'aider à comprendre ? Je vous remercie, bonne journée.

4 replies (on page 1 of 1)

Jump to last post

Finalement, j'ai résolu le problème. J'ai juste eu à télécharger l'extension sur chrome "Moesif Orign & CORS Changer".

Happy to hear you sorted it out.


Wait but why? :)

This chrome extension you mention probably adds some request headers like "Allow-Control-Allow-Origin": "*", which I added manually to my request code, but I cannot still fetch. Though my app is able to do preflight request as I inspect.

The url for my above requests is
(same for

I can successfully get the data when I try in a new tab.

However I have no problem fetching for example the movie owner of the question wrote in my app without any additional thing, header etc. :

my code is as follows:

async function getData() {
        let response = await fetch("");
        let json = await response.json();

@fselcukcan Are you having an issue? I can't quite tell if you need help or not. If so, give me some more info as to what is failing.



s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page