Oauth 2:access_token是用户的唯一键吗? [英] Oauth 2: Is access_token a unique key for User?
问题描述
用户与Facebook连接后,Facebook以 access_token
。
After a user connects with Facebook, Facebook responds with an access_token
.
我可以假设这个 access_token
始终保持不变,是唯一的对于每个用户?
Can I assume this access_token
will always stay the same and is unique for every user?
如果是这样,那么我可以使用它来查找我的数据库中的用户,如果找不到,创建一个新的用户。
If so, then I can use it to find the user in my database, and if not found, create a new user.
如果没有,有没有办法要求Facebook还发回你 user_id
(与 access_token
)在连接之后,我不必另行要求 / me?fields = id
?
If not, is there a way to ask Facebook to also send you back user_id
(with the access_token
) right after connecting so that I don't have to make another request to /me?fields=id
for it?
推荐答案
您应该使用他们的 id
作为唯一标识符。 access_token
是唯一的,但每次请求一个时,您都会收到一个新的。
You should use their id
as a unique identifier. The access_token
is unique, but you'll get a new one every time you request one.
这篇关于Oauth 2:access_token是用户的唯一键吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!