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);
}
};
Can't find a movie or TV show? Login to create it.
Elementu hau kalifikatu edo zerrenda batera gehitzea nahi al duzu?
Ez zara kidea?
bin28 Erabiltzailearen Erantzuna
Uztaila 19, 2024 egunean 2:51 AM(e)tan
AUTHORIZATION with display: Sorry, you cannot authenticate with that credentials
Travis Bell Erabiltzailearen Erantzuna
Uztaila 19, 2024 egunean 11:24 AM(e)tan
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.