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:
1
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
2
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.3
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:
4
Using the Access Token
Finally, use the access token in the Authorization header to make authenticated API requests.You can now access user-specific endpoints and perform actions on behalf of the user.
Replace
12345678 with the actual account ID you received in the previous step.