I go through the authentication process using v4 with no issues, but how can I get the user data if I have the account_id & access_token that is returned from v4 auth? The only result I found is https://api.themoviedb.org/3/account/{account_id} but it needs an integer id, while the one returned from v4 is a String
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by robbie3999
on May 21, 2023 at 7:28 PM
Not sure I totally understand your problem - but I believe the account_id is a unique integer that identifies each user account. It is not specific to v3 or v4 endpoints. Mine is an 8 digit integer. So you can access account details using the url you specified using either v3 or v4 authentication.
Doc is here: https://developer.themoviedb.org/reference/account-details
If your not sure what your account_id is, you can click the "Log In" button in the upper right corner of the doc page, then navigate back to the same page and your number will be autofilled in the account_id field.
Reply by abalmagd
on May 22, 2023 at 12:23 AM
Let me explain further, using Travis' jQuery auth pages:
For the first example (v4 auth), I am using http://dev.travisbell.com/play/v4_auth.html
This is what I get back when a user authenticates:
Account ID
62630317f495ee0e12997843
This id is not an integer
For second example (v3 auth), I am using http://dev.travisbell.com/play/v3_auth.html
This is what I get back when a user authenticates:
Session ID
bf0ba107fad535e7e4282724e2bcca897394a14c
Which is not an account ID and not an integer also
So, in both cases, when a user uses my app and logs in, how do I get their account ID so that I can use it to get their profile data like name/image?
Reply by robbie3999
on May 22, 2023 at 1:20 PM
Ok, so you need other user's account id. After a little experimentation with the "try it" button on the doc page, these queries work ("account_id" is the literal string and not a number)
https://api.themoviedb.org/3/account/account_id
https://api.themoviedb.org/3/account/account_id?session_id=SESSION_ID
The first call would have to be returning the account details associated with the authentication token, there is no other possibility. The second call could be returning the same as the first or it could be returning the account associated with the session id. I don't have any test accounts so the session id I used was created from my own account.
You could try the second form and see if it works for any user, or perhaps Travis will come along and shed some light on this.
Reply by dante1212
on August 30, 2023 at 10:59 AM
hello. i have same question. you find answer?