Expected Behaviour: Examples should show the API in URL for making a request.
Actual Behaviour: API Key is shown in the authorization header in examples and running the example is causing a 401 error.
This issue is persisting in all the examples. Also, my authorization with a token is working fine without any issue.
The example code with node-:
const fetch = require('node-fetch');
const url = 'https://api.themoviedb.org/3/authentication';
const options = {
method: 'GET',
headers: {
accept: 'application/json',
Authorization: 'Bearer 2sdffsfsdeea43ba10423rt'
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
فیلم و نمایش تلویزیونی را نمیتوانید پیدا کنید؟ به سیستم وارد شوید تا آن را ایجاد کنید.
آیا میخواهید به این مورد امتیاز دهید یا به فهرست اضافه کنید؟
عضو نیستید؟
پاسخ توسط brendonsreimer
در تاریخ اکتبر 12, 2023 ساعت 3:08 ب.ض
Agreed. The documentation shows that you should include the API key in the authorization header, but that always fails with a 401. The request only works when you pass the API key through the URL. This is very confusing to the user.
پاسخ توسط vvn123
در تاریخ اکتبر 12, 2023 ساعت 4:35 ب.ض
If you are using API Key use it in the URL like this. Do not put it in the header.
پاسخ توسط superboy97
در تاریخ اکتبر 13, 2023 ساعت 2:06 ق.ض
The examples are wrong. As explained here, if you want to use the Authorization header, this is the Bearer token that you should put in it.