如何强制Android Facebook SDK重新认证 [英] How to force android facebook sdk to re-authenticate

查看:169
本文介绍了如何强制Android Facebook SDK重新认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

短版:我希望我的应用以某种方式删除/重置同一设备上的Facebook Apps,以便注销后它总是要求人们登录Facebook Apps并忘记所有帐户历史记录维护隐私.

Short version: I want my app to somehow delete/reset the Facebook Apps on the same device, so that after logout it will always ask people to login in Facebook Apps and forget all the account history to maintain the privacy.

长版: 我正在构建一个执行以下特定任务的android应用程序:

Long version: I am building an android apps that do a specific tasks like this:

  1. 应用程序将捕获图像
  2. 这些应用将要求用户登录Facebook(例如,Facebook集成)
  3. 然后,这些应用将尝试通过用户的Facebook帐户共享捕获的图像
  4. 然后,这些应用将自动注销当前用户帐户

我遵循Android Facebook SDK文档来构建登录功能.它说我的设备必须安装了Facebook应用程序,所以我确实安装了它,一切都很好.

I follow Android Facebook SDK documentation to build the login features. It stated that my device must have Facebook Application installed so I did install it, and everything are well.

图像共享进展顺利.

但是,然后我希望我的应用程序完全注销当前的Facebook帐户.我使用此处的回答,通过使用以下代码:

But then I want my app to logout the current Facebook Account completely. I followed the answer from here by using the following code:

public void disconnectFromFacebook() {

    if (AccessToken.getCurrentAccessToken() == null) {
        return; // already logged out
    }

    new GraphRequest(AccessToken.getCurrentAccessToken(), "/me/permissions/", null, HttpMethod.DELETE, new GraphRequest
            .Callback() {
        @Override
        public void onCompleted(GraphResponse graphResponse) {

            LoginManager.getInstance().logOut();

        }
    }).executeAsync();
}

它确实已注销,但是已经在Facebook Apps中登录的Facebook帐户将保持不变.然后,当另一个用户想要登录时,将弹出这样的场景 ,表示Facebook Apps保存了帐户历史记录,并且没有完全注销.

It did logout, but the Facebook Account that already logged in at the Facebook Apps will remain intact. Then when another user want to login, a scene like this will popup, indicating that the Facebook Apps save the account history and did not Logged out completely.

由于我的应用程序将部署在人们可以自由捕获照片并通过我的应用程序将其共享到Facebook的公共场所,因此我希望我的应用程序始终从设备永久注销Facebook帐户.这意味着,当下一个人使用我的应用程序时,我希望它询问全新的Facebook登录身份验证,而Facebook应用程序不会记住每个登录它的人.

Since my Apps will be deployed on public places where people can freely capture photos and share it to Facebook via my Apps, I want my Apps to always Logout the Facebook Account permanently from my device. This means that, when the next people use my Apps I want it to ask a brand new Facebook Login authentication without the Facebook Apps remembering every person that logged to it.

我已经尝试了一些解决方法:

I already try some of the workaround:

  1. 此处所述,我禁止Facebook登录使用webview , 这种解决方案似乎总是要求登录身份验证,但是 它也将重定向到Facebook Apps,因此毫无意义.
  2. 我正在考虑通过Web应用程序共享图像,但不仅不能使用我的代码自动共享图像,而且回调也不会到达我的应用程序.此外,文档还指出,所有共享任务都必须使用Facebook SDK完成.
  1. I suppress the facebook login to use webview as stated from here, this solution seems to always ask a login authentication, but then it will also redirect to Facebook Apps so it is pointless.
  2. I am thinking to share the image via web application, but not only it will be unable to share automatically using my code, the callback will not reach my application. Plus, the documentation also stated that all sharing task must be done using Facebook SDK.

抱歉,我不能更好地编译我的问题.

Sorry should I not compile my question better.

谢谢.

推荐答案

尝试使用Web API而不是Personal App进行验证,使用Mobile Application登录Facebook仅适用于私人用户.这是完整的 facebook 4.0.+登录示例.

Try the verification using web APIs instead of the Personal App, Facebook login with Mobile Application is intended for private users only. Here is a full facebook 4.0.+ login example.

这篇关于如何强制Android Facebook SDK重新认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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