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
找不到电影或节目?登录并创建它吧。
robbie3999 的回复
于 2023 年 05 月 21 日 7:28下午
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.
abalmagd 的回复
于 2023 年 05 月 22 日 12:23上午
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?
robbie3999 的回复
于 2023 年 05 月 22 日 1:20下午
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.
dante1212 的回复
于 2023 年 08 月 30 日 10:59上午
hello. i have same question. you find answer?