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.
映画やテレビ番組が見つかりませんか?ログインして作成してください。
このアイテムを評価したり、リストに追加したりしたいですか?
メンバーではありませんか?
robbie3999からの返信
投稿:2023年07月20日 6:11 PM
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からの返信
投稿:2023年07月21日 8:01 AM
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: