c-eg / themoviedbapi

A Java wrapper around the JSON API provided by TheMovieDB.org
https://www.themoviedb.org/
Other
281 stars 95 forks source link

Error API Key #238

Closed DavidSilvain closed 2 months ago

DavidSilvain commented 2 months ago

Hello, thank you very much for the work done. I use version 1.15 in my project and everything works fine. I wanted to use the latest version, so I adapted my code, unfortunately I now have an error at the API key level. It is not the cause because it works very well on the site and with version 1.15. So I created a new project just to test with the example you propose:

TmdbApi tmdbApi = new TmdbApi(TMDB.API_KEY); TmdbMovies tmdbMovies = tmdbApi.getMovies(); try { MovieDb movie = tmdbMovies.getDetails(5353, "en-US"); System.out.println("movie = " + movie.getTitle()); } catch (TmdbException e) { e.printStackTrace(); }

From version 2.1 I always have this error: TmdbResponseException(responseCode=TmdbResponseCode.INVALID_API_KEY(tmdbCode=7, httpStatus=401, success=false, message=Invalid API key: You must be granted a valid key.))

From 2.0, I have this error: Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/markers/KMappedMarker

Version 1.15.1 works fine.

I have set the dependencies correctly. Do you have any idea what it could be.

Thanks

c-eg commented 2 months ago

Hi,

Thanks for the descriptive issue report :)

I think you might be using the old API key from the settings page. On my settings page there are two different API keys:

Please can you retry using the "API Read Access Token" with the latest version (currently 2.1.2) and let me know if that fixes the issue.

DavidSilvain commented 2 months ago

Hi, That was the problem! Thank you very much! Problem solved

c-eg commented 2 months ago

That's great, glad it's working. I'll update the readme so it's a clearer which API key you should be using.