The Movie Database Support

Hi, i tried to understand the sign in process for a user to be able to set watchlists, rate etc.

I request a new Token, than i use the UserName and Password to validate with login and get a new token response, but if i go to the wegsite that should verify the token i always get this error:

Invalid Request Token The access token you have submitted is invalid. Most of the time, this is because the token has expired. Try creating a new one and making sure you have copied it correctly. If you continue to have issues, contact the developer of the app you're using.

19 replies (on page 1 of 2)

Jump to last post

Next pageLast page

So i just got around to the "Grant Permission" Website, but even if i grant, i am not able to generate a Session id due any kind or API Key, it says invalid Key...

Are you using v3 or v4 auth? Here's a one page example that walks you through all of the steps to validate and create a v4 access token for example. All of the code is front end JS so you can see exactly what is happening (there's no backend code.)

I am using the Documentation from the API Homepage, so i guess it is V4, anyway, can you provide a Link to the sample codes?

So i just retried from the API homepage following the steps:

  1. request Token, got one
  2. send User to Page to grant the token, done
  3. request session id using the token i requested previously: API Homepage try out:

Response: { "failure": true, "status_code": 17, "status_message": "Session denied." } WTF?!

Oops, sorry, I didn't actually link my test scripts. It's located here.

I just gave it a run through and everything is working properly, so make sure to take a look at the source JS to see what I am doing. Paste your v4 read access token and then just click through the "step" buttons.

Yes, the script works, but the results are useless, i went through to get an access token, which i cannot use anywhere, it always says, invalid API Key, you must be granted permission, i approved it, checked my account for connected Apps and it is blank.

The list of approved apps in your account will only be v3 sessions. There is no v4 list.

So what is an specific example call you're trying to make that is returning an invalid key error?

P.S. you can use the authorized v4 access token here, as an example. It enables you to add/remove items to your list.

Sample: I go through your Script to generate an Access Token, this token i use as my API Key for the following Reqeust to get my Watched List:

https://api.themoviedb.org/3/account/{account_id}/watchlist/movies?api_key=

But on the API HP try out i get always these responses:

{ "status_code": 7, "status_message": "Invalid API key: You must be granted a valid key." }

v4 and v3 are not the same thing. You're trying to do things on v3 with a v4 token.

If you're wanting to (for example) do things with your account's watchlist, you'll need to go down the v3 session path, and not v4. The process for that is located here.

However, you can also use this method to convert a v4 (write) token to a v3 session. That could be the best thing to do since you get auth on both v3 and v4 this way. v4 lists are a lot better than v3 lists for example.

Thats a pain at all, i take ma V4 Access token and use it as my API Key in the convert Method, all i get is this:

{ "failure": true, "status_code": 35, "status_message": "Invalid token." }

I would suggest keeping things simple and just using v3 for now then.

Request Token

GET https://api.themoviedb.org/3/authentication/token/new?api_key={{api_key}}
{
    "success": true,
    "expires_at": "2019-07-16 17:36:02 UTC",
    "request_token": "03e06be965691494xxxxxxxxxxxxxxx"
}

Approve token

GET https://www.themoviedb.org/authenticate/03e06be965691494xxxxxxxxxxxxxxx

Create Session

GET https://api.themoviedb.org/3/authentication/session/new?api_key={{api_key}}&request_token=03e06be965691494xxxxxxxxxxxxxxx

{
    "success": true,
    "session_id": "de9a8cce1d9d31e33xxxxxxxxxxxxxx"
}

Add To Watchlist

POST https://api.themoviedb.org/3/account/548/watchlist?api_key={{api_key}}&session_id=de9a8cce1d9d31e33xxxxxxxxxxxxxx
BODY { "media_type": "movie", "media_id": 284054, "watchlist": true }

{
    "status_code": 1,
    "status_message": "Success."
}

this does not explain how to get a valid Session ID

Anyway, while the V4 Auth is useless on the Users Side (no management), can i simply stick the V3 for now,

In my understanding of the Docs, i need to make 3 calls to get a Session ID,

  1. request a token 2.auth the user
  2. create session ID

i create s token, go to the page 100 https://www.themoviedb.org/authenticate/{req token}

Approve it (the App is still not listed in the Connected Apps if i use the Docs try out section for Step 1!!!)

Anyway, i try to create a Session ID but get error "permission need t be granted"

So for dummies like me, can you please provide a simple URL for step 1,2 and 3 where i can just replace my API Key for Step 1

And finally, to confirm it is working, a simple Call to any User Section lie Details with the Session ID from step 3, just for demonstration, please?

I would love to integrate my App with tMDb, but this whole provess doesnt't work here at all and i am trying since days in verious ways...

thx in advance

The de9a8cce1d9d31e33xxxxxxxxxxxxxx key above is a valid session ID, you can see me use it in the very next call to add an item to my watchlist. I just did these steps and it all works perfectly. The steps I outlined above are everything you need to do.

Approve token GET https://www.themoviedb.org/authenticate/03e06be965691494xxxxxxxxxxxxxxx

this part, NEVER WORKING , NEVER !!!

Here's a set of v3 and v4 test scripts that I just used without any trouble:

v3

v4

All of the code is client side JS, so you can inspect the code to see exactly what I'm doing. There's nothing server side in use here.

Can't find a movie or TV show? Login to create it.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login