Oauth 2:access_token是用户的唯一键吗? [英] Oauth 2: Is access_token a unique key for User?

查看:656
本文介绍了Oauth 2:access_token是用户的唯一键吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户与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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆