I dont know why it dont work.... use it like that :
const url = 'https://api.themoviedb.org/3/movie/top_rated?language=en-US&page=1';
const options = {
method: 'GET',
headers: {
accept: 'application/json',
Authorization: 'Bearer MyAPIKey'
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));
Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.
Vous souhaitez évaluer ou ajouter cet élément à une liste ?
Pas encore membre ?
Réponse de Travis Bell
le 7 août 2024 à 10h58
You can't use your API key as a bearer token. If you want to use bearer authentication, make sure to use your access token.
You can read more about this here, in the docs: https://developer.themoviedb.org/docs/authentication-application