Suport de The Movie Database

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

4 resposta (a les pàgines 1 de 1)

Jump to last post

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.

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?

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.

@abalmagd said:

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?

hello. i have same question. you find answer?

No trobeu una pel·lícula o una sèrie? Inicieu la sessió per a crear-la.

Global

s centra la barra de cerca
p obre el menú del perfil
esc tanca una finestra oberta
? obre la finestra de dreceres de teclat

A les pàgines de materials

b torna enrere (o la superior quan sigui aplicable)
e ves a la pàgina d’edició

A les pàgines de temporades

(fletxa dreta) ves a la temporada següent
(fletxa esquerra) ves a la temporada anterior

A les pàgines d'episodis

(fletxa dreta) ves a l'episodi següent
(fletxa esquerra) ves a l'episodi anterior

A totes les pàgines d'imatges

a obre la finestra d'afegir imatges

A totes les pàgines d'edició

t obre el selector de traducció
ctrl+ s envia el formulari

A les pàgines de debat

n crea un debat nou
w canvia l'estat de visualització
p canvia públic/privat
c tanca o obre
a obre activitat
r resposta al debat
l ves a la darrera resposta
ctrl+ enter envieu el vostre missatge
(fletxa dreta) pàgina següent
(fletxa esquerra) pàgina anterior

Configuracions

Desitgeu valorar o afegir aquest element a una llista?

Inicieu la sessió