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.
Want to rate or add this item to a list?
Not a member?
Reply by bin28
on July 19, 2024 at 2:51 AM
AUTHORIZATION with display: Sorry, you cannot authenticate with that credentials
Reply by Travis Bell
on July 19, 2024 at 11:24 AM
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.