const fetchTrendingMovies = async () => {
try {
const res = await axios.get('https://api.themoviedb.org/3/trending/movie/day', {
params: {
language: 'en-US',
page: 1
},
headers: {
Authorization: `Bearer ${process.env.REACT_APP_API_TOKEN}`
}
});
setMovies(res.data.results);
} catch (error) {
console.error('Lỗi khi lấy phim thịnh hành: ', error);
}
};
Non podes atopar unha película ou serie? Inicia sesión para creala.
Queres valorar ou engadir o elemento a unha listaxe?
Non es membro?
Resposta de bin28
no 19 de xullo do 2024 ás 2:51AM
AUTHORIZATION with display: Sorry, you cannot authenticate with that credentials
Resposta de Travis Bell
no 19 de xullo do 2024 ás 11:24AM
Is
REACT_APP_API_TOKEN
your API key, or your access token? It needs to be your access token if you're using bearer authorization. Using your API key as a bearer token will not work.Keep in mind, if you re-generated your API key, you will need to grab a new access token.