When I try the api out in the browser using my api key, I receive the correct data. However, when I fetch that link in my code, I receive that error. I am running my code in NextJs13 and Typescript.
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?
robbie3999 Erabiltzailearen Erantzuna
Uztaila 20, 2023 egunean 6:11 PM(e)tan
Hi @tacolegs2004, hard to tell without seeing more information, but it looks like whatever variable you are using for the api_key is undefined when you use it.
If you are reading the key from an env file, then see these discussions about what can go wrong:
https://stackoverflow.com/questions/49579028/adding-an-env-file-to-a-react-project
https://stackoverflow.com/questions/48378337/create-react-app-not-picking-up-env-files
ticao2 š§š· pt-BR Erabiltzailearen Erantzuna
Uztaila 21, 2023 egunean 8:01 AM(e)tan
It would help to know which of the 401 error responses you are getting.
See the list of TMDb server error warnings here.
https://www.themoviedb.org/documentation/api/status-codes
In your case: