The Movie Database 支持

Hi I would like to know why my API is not working. when I try to use it with axios I get an error 401 and I tried verifying it using the authentication on your website and it gives me a status of false

10 回复(第 1 页,共 1 页)

Jump to last post

@TheKillerAlphaX said:
API Error
Hi I would like to know why my API is not working.
when I try to use it with axios I get an error 401 and I tried verifying it using the authentication on your website and it gives me a status of false

Take a Test
In the URL below, change THE_KEY to your API Key.
https://api.themoviedb.org/3/movie/550?api_key=THE_KEY
Use this example to do a search using a new tab or window in your browser.
You will receive the basic data of the Movie Fight Club (1999)
https://www.themoviedb.org/movie/550-fight-club
If it works, your Key is OK.

When there is a problem, the TMDb Server sends a message.
Can you tell which message the server sent?
Here is a list of possible messages:
https://developer.themoviedb.org/docs/errors

If it does not work, let us know right here.

i face that issue in 2 parts i will attach the code to both for your satisfaction

  1. when i tried to refrence the url:: (instead of fetchTrending: '/trending/all/week?api_key=${API_KEY}&language=en-US',) i have to manually insert my key for it to work

//CODE
//const API_KEY = "THE_KEY";

const requests = {
fetchTrending: '/trending/all/week?api_key=THE_KEY&language=en-US',
fetchNetflixOriginals: '/discover/tv?api_key=THE_KEY&with_networks=213',
fetchTopRated: '/movie/top_rated?api_key=THE_KEY&language=en-US',
fetchActionMovies: '/discover/movie?api_key=THE_KEY&with_genres=28',
fetchComedyMovies: '/discover/movie?api_key=THE_KEY&with_genres=35',
fetchHorrorMovies: '/discover/movie?api_key=THE_KEY&with_genres=27',
fetchRomanceMovies: '/discover/movie?api_key=THE_KEY&with_genres=10749',
fetchDocumentaries: '/discover/movie?api_key=THE_KEY&with_genres=99',

}

export default requests;
  1. after manually inserting the keys into the links as shown above, i cant get the posters to show up neither with a movie.backdrop_path or a movie.poster_path

Hi @TheKillerAlphaX, if you can manually insert your key and get your code to work, then you have an error in your code. You might want to investigate whether your ${API_KEY} value is getting set properly by printing it out before you use it.

You should --never-- publish your api key in a public forum, it is a private key that should be protected like a password. Please edit the post and replace your key with a string like "xxxx".

To use images you need to read the image basics that describes how to build an image url from the information returned.

@TheKillerAlphaX
I will replace your API Key with THE_KEY expression.
It is not good to show your Key to all forum users.

@TheKillerAlphaX said:

  1. after manually inserting the keys into the links as shown above,
    i cant get the posters to show up neither with a movie.backdrop_path or a movie.poster_path

When I make this API Request I receive the data with poster_path and backdrop_path of the items.
Don't you get a similar response?

........... fetchTrending: '/trending/all/week?api_key=THE_KEY&language=en-US
https://api.themoviedb.org/3/trending/all/week?api_key=THE_KEY&language=en-US
page    1
results 
0   
adult   false
backdrop_path   "/4HodYYKEIsGOdinkGi2Ucz6X9i0.jpg"
id  569094
title   "Spider-Man: Across the Spider-Verse"
original_language   "en"
original_title  "Spider-Man: Across the Spider-Verse"
overview    "After reuniting with Gwe…ve those he loves most."
poster_path "/8Vt6mWEReuy4Of61Lnj5Xj704m8.jpg"
media_type  "movie"
genre_ids   […]
popularity  3368.627
release_date    "2023-05-31"
video   false
vote_average    8.459
vote_count  3403
1   
adult   false
backdrop_path   "/nHf61UzkfFno5X1ofIhugCPus2R.jpg"
id  346698
title   "Barbie"
original_language   "en"
original_title  "Barbie"
overview    "Barbie and Ken are havin…of living among humans."
poster_path "/iuFNMS8U5cb6xfzi51Dbkovj7vM.jpg"
media_type  "movie"
genre_ids   […]
popularity  1976.513
release_date    "2023-07-19"
video   false
vote_average    7.5
vote_count  3025
2   
adult   false
backdrop_path   "/rLb2cwF3Pazuxaj0sRXQ037tGI1.jpg"
id  872585
title   "Oppenheimer"
...

it does show up for me. but i dont know why when i use it in code it doesnt. and it doesnt show the posters either

@robbie3999 said:

Hi @TheKillerAlphaX, if you can manually insert your key and get your code to work, then you have an error in your code. You might want to investigate whether your ${API_KEY} value is getting set properly by printing it out before you use it.

You should --never-- publish your api key in a public forum, it is a private key that should be protected like a password. Please edit the post and replace your key with a string like "xxxx".

To use images you need to read the image basics that describes how to build an image url from the information returned.

am really sorry. i didnt know that

@TheKillerAlphaX said:

@robbie3999 said:
Hi @TheKillerAlphaX, ...
You should --never-- publish your api key in a public forum, it is a private key that should be protected like a password. Please edit the post and replace your key with a string like "xxxx".

am really sorry. i didnt know that

I assume you are referring to the issue of showing your API Key to the public.
If not, explain to me what you said.

it does show up for me. but i dont know why when i use it in code it doesnt. and it doesnt show the posters either

I ask you two things, if possible.
1 - Post here the response that the TMDb Server sends you.
2 - Post here the API Request that your code is sending to our server.
Not the process of creating or building the Request but the complete Request that is submitted.

Hey Killer Alpha, i think we are working through the same tutorial, i am having the same issue getting the data to connect. Were you able to figure it out?

找不到电影或节目?登录并创建它吧。

全站通用

s 聚焦到搜索栏
p 打开个人资料菜单
esc 关闭打开的窗口
? 打开键盘快捷键窗口

在媒体页面

b 返回(或返回上级)
e 进入编辑页面

在电视季页面

(右箭头)下一季
(左箭头)前一季

在电视集页面

(右箭头)下一集
(左箭头)上一集

在所有图像页面

a 打开添加图片窗口

在所有编辑页面

t 打开翻译选择器
ctrl+ s 提交

在讨论页面

n 创建新讨论
w 切换关注状态
p 设为公开 / 私密讨论
c 关闭 / 开放讨论
a 打开活动页
r 回复讨论
l 跳转至最新回复
ctrl+ enter 发送信息
(右箭头)下一页
(左箭头)前一页

设置

想给这个条目评分或将其添加到片单中?

登录

还不是会员?

注册加入社区