🍿 @lorenzopant/tmdb

Create Request Token

Generate a short-lived request token — step 1 of the v3 session flow.

Generates a temporary request token that must be approved by the user before it can be exchanged for a session ID. This is step 1 of the v3 session flow.

The token expires after 60 minutes if not used. After receiving it, redirect the user to:

https://www.themoviedb.org/authenticate/{request_token}

Or with a redirect back to your app:

https://www.themoviedb.org/authenticate/{request_token}?redirect_to=https://yourapp.com/callback

Once the user approves, pass the token to create_session().

async create_request_token(): Promise<AuthRequestTokenResponse>

TMDB Reference: Create Request Token

Parameters

None.

Returns

AuthRequestTokenResponse

Errors

HTTPTMDB codeCause
4013Invalid or missing access token.

Example

import { TMDB } from "@lorenzopant/tmdb";

const tmdb = new TMDB("your-access-token");
const { request_token, expires_at } = await tmdb.authentication.create_request_token();

// Redirect the user to approve the token
const approvalUrl = `https://www.themoviedb.org/authenticate/${request_token}`;
console.log(approvalUrl);

On this page