facebook accessToken 和移动应用程序中的安全性
我正在构建一个可以用手机玩的社交游戏平台。我对登录部分和访问令牌感到困惑。让我简要解释一下我的问题。
问题:用户使用 facebook 登录名登录,我检索用户的 accessToken。然后登录后我立即将此 accessToken 存储在我的数据库中。用户继续游戏。然后,在某些时候,当我想将某些内容发布到用户墙上时,移动端会调用 WebService,而我的部分(C#)使用存储在数据库中的访问令牌并将某些内容发布到墙上。到这里一切都还好。但是当访问令牌过期或用户更改密码时会发生什么。然后我必须重新获取accessToken并更新数据库。
但是当 accessToken 发生变化时我如何收到通知?我必须收到通知,否则我的令牌将会过期,并且无法发布内容。
谢谢
I am building a social gaming platform which will be played with mobiles. I am confused about the login part and access token. Let me briefly explain my problem.
Problem: User logs in with facebook login and I retrieve the accessToken of the user. Then immediately after login I store this accessToken in my database. The user continues with the game. Then in some point when I want to post something to the users wall the mobile side calls a WebService and my part (C#) uses the access token stored in the DB and posts something to the wall. Until here everything is OK. But what happens when the access Token expires or the user changes his password. Then I have to re-get the accessToken and update the DB.
BUT how do I get notified when the accessToken changes? I have to get notified or I will have a expired token and won't be able to post something.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当令牌过期时,您不会收到通知,但 Facebook 会在您的响应中给出过期时间,您应该存储该时间。
根据 OAuth 规范,如果您尝试使用无效/过期的令牌,您将收到 HTTP 401 Unauthorized 以及以下信息:
You won't get notified when a token expires, but Facebook give you the expiry time in your response, which you should store.
According to the OAuth spec, you will receive an HTTP 401 Unauthorized if you try to use an invalid/expired token, as well as the following: