Hi Guys,
I’m currently working on the film finder project.
I’m at the point where I’m fetching the data from the TMDB but I’m getting a weird error saying that my API key is not valid.
Here is a portion of my code.
const getGenres = async () => {
const genreRequestEndpoint = "/genre/movie/list";
const requestParams = `?key=${tmdbKey}`;
const urlToFetch = tmdbBaseUrl + genreRequestEndpoint + requestParams;
console.log(urlToFetch)
try {
const response = await fetch(urlToFetch)
if (response.ok) {
const jsonResponse = await response.json();
const genres = jsonResponse.genres;
return genres;
}
throw new Error("Error with Request!");
} catch (e) {
console.log(e);
}
};
and here is the error I’m getting when I use the URL that’s generated by my app.
{
status_code: 7,
status_message: "Invalid API key: You must be granted a valid key.",
success: false
}
I have checked, double-checked copy + pasted and it’s still not valid. Does anyone else have this issue or have any idea what I’ve done wrong?
Any guidance would be greatly appreciated.