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);
}
};
لم تجد الفلم أو المسلسل ؟ سجل دخولك و انشئها
هل تريد تقييم او اضافة هذا العنصر للقائمة؟
لست عضو؟
رد بواسطة bin28
بتاريخ يوليو 19, 2024 في 2:51 صباحا
AUTHORIZATION with display: Sorry, you cannot authenticate with that credentials
رد بواسطة Travis Bell
بتاريخ يوليو 19, 2024 في 11:24 صباحا
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.