问题描述
您好我用我的Android手机上Android的Facebook的SDK,并使用单点登录。它工作正常,当我登录到Facebook应用程序,我的应用程序中也签署。
对于注销我遇到了一个困惑。
Hello I am using the facebook sdk for android on my android phone and using single sign on. It works fine when I logged into the facebook application, my application also signed in.For logout I encountered a confusion.
我实现的方法是恢复从应用程序的用户preferences访问令牌和过期日期和检查会话的有效性。如果过期的应用程序调用facebook.authorized功能,一旦授权的访问令牌和过期日期将再次更新。
The way I implemented was restore the access token and expired date from the user preferences of the application and check the validity of the session. If expired the application calls the facebook.authorized function and once authorized the access token and expired date will update again.
有几件事情的处理注销当我发现有点混乱。
There are few things I find a bit confusion when dealing with the logout.
1)当我从Facebook应用程序注销,我的应用程序仍然可以打通并请求用户的详细信息。虽然,在我的应用我保存的访问令牌与Facebook应用程序没有关系,我想请求数据时,它至少给我一个错误。但它并没有给我的错误。
1) When I logged out from facebook application, my application still can get through and request the user details. Although, my saved access token on my application has no relationship with the facebook application, I thought it will at least giving me an error when requesting the data. But it hasn't given me the error.
是否假设是actting这样。从Facebook应用程序退出将不会影响我已存储在我的应用程序的访问令牌。
Does it suppose to be actting like that. Signing out from facebook apps will not affect the access token I have stored on my application.
2)当我从我的应用程序注销,而不是Facebook应用程序,Facebook应用程序不会自动注销。
2) When I logged out from my application and not the facebook application, the facebook application won't automatically logout.
推荐答案
在Facebook的访问令牌和您的应用程序访问令牌是分开的,不同的,所以它是完全可能的,可以是有效的,并允许访问,而其他无效和将需要重新授权
The Facebook access token and your app access token are separate and distinct, so it is entirely possible that one can be valid and allow access while the other is not valid and will require re-authorisation.
如果Facebook应用程序已经登录,但您的应用程序不是,那么Facebook的SDK将使用现有的Facebook应用程序登录,以获得为您的应用新的访问令牌不进行身份验证,但这仍然未链接到Facebook应用程序登录令牌以任何方式。
If the Facebook app is logged in but your app is not, then the Facebook SDK will use the existing Facebook app login to obtain a new access token for your app without authenticating, but this is still not linked to the Facebook app login token in any way.
如果Facebook应用程序没有安装,或者没有登录,那么Facebook的SDK将带您到Facebook网站做初步验证,但因为有您的访问之间没有任何联系,这并不登录Facebook应用程序令牌和Facebook的访问令牌。
If the Facebook app is not installed, or not logged in, then the Facebook SDK will take you to the Facebook website to do the initial authentication, but this does not log the Facebook app in because there is no connection between your access token and the Facebook access token.
因此,简言之 - 你的理解是正确的。还有,除了当你的应用程序尝试对用户进行身份验证,那么Facebook应用程序将作为代理,让您获得无需验证,只要Facebook正在登录的两个应用程序之间没有互动。在那之后,有没有进一步的互动和你所观察到的预期和预期的行为。什么
So, in summary - your understanding is correct. There's no interaction between the two apps except for when your app tries to authenticate a user, then the Facebook app will act as a proxy, allowing you to gain access without authenticating so long as Facebook is logged in. After that, there is no further interaction and what you've observed is expected and intended behaviour.
这篇关于安卓:Facebook的SDK退出的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!