Version 4 of the TMDB API uses OAuth 2.0 for authentication, which is more secure and versatile than the API key system used in v3. This authentication method allows applications to access user-specific data with proper user consent. Follow this steps below for your authentication:
Create a Request Token
To begin the authentication process, you need to create a request token by making a Response
POST request to the TMDB API.- The redirect URL (or callback) is an optional parameter you can include with this request. It will execute the request token and grant approval on TMDB.
- The
request_tokenis valid for 60 minutes
Asking for approval on TMDB
Next, In order for a user to approve the request token, they have to be redirected to the website.
Ensure you replace
request_token with the token received in the previous step.Create an Access Token
After the request_token has been approved, exchange the request token for an access token.You’ll receive a response containing an access token and account ID: