简体   繁体   English

使用Facebook图形API共享链接后,Android解析Facebook登录无法正常工作。

[英]Android parse facebook login not working after using facebook graph api to share link.

I have an Android app with parse login with Facebook that works just fine… I´m building a new version of the app in which the app has the capability to do share to a Facebook Page, as the page. 我有一个可以与Facebook进行解析登录的Android应用程序,该应用程序运行得很好……我正在构建该应用程序的新版本,其中该应用程序能够与页面共享到Facebook页面。 This is my code: 这是我的代码:

this is the code to request the list of pages the user manages 这是请求用户管理的页面列表的代码

    final Session session = Session.getActiveSession();
    List<String> PERMISSIONS = Arrays.asList("publish_actions, publish_pages, manage_pages,user_about_me");
    Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(activity,PERMISSIONS);
    session.requestNewPublishPermissions(newPermissionsRequest);

    new Request(
             session,
             "/me/accounts",
             null,
             HttpMethod.GET,
             new Request.Callback() {
             public void onCompleted(Response response) {
             /* handle the result */}

Once selected a page, the link share is done by: 选择页面后,可通过以下方式完成链接共享:

    final String id = json_obj.getString("id");
    String token = json_obj.getString("access_token");
    Date date = new Date(3600);
    List<String> PERMISSIONS = Arrays.asList("publish_actions, publish_pages, manage_pages,user_about_me");

    final Bundle params = new Bundle();
    params.putString("message", message);
    params.putString("access_token", token);
    params.putString("link", link);
    params.putString("picture", image);

    new Request(
          session,
          "/" + id + "/feed",
          params,
          HttpMethod.POST,
          new Request.Callback() {
          public void onCompleted(Response response) {
          /* handle the result */}

The code works just fine, the link is posted to a Facebook Page, as the facebook page. 该代码工作正常,该链接已发布到Facebook页面,即facebook页面。

The problem comes when the user logs off and tries to log back in with facebook. 当用户注销并尝试使用Facebook重新登录时,就会出现问题。 Parse log in fails, without error message, and returns a null user. 解析登录失败,没有错误消息,并返回空用户。 The weird thing is that this keeps on happening the particular device where the code was run, matter what user tries to login, or even if we uninstall the app and install a previous version which was working perfectly. 奇怪的是,这种情况一直在运行代码的特定设备上发生,无论用户尝试登录什么,甚至即使我们卸载了该应用程序并安装了运行正常的先前版本,也是如此。

So far I've tested with three different devices and I get the same result, everything works fine before doing the facebook share as page. 到目前为止,我已经使用三种不同的设备进行了测试,并且得到了相同的结果,在将Facebook分享为页面之前,一切工作正常。 After that, no matter what user or what version of the app I run, the parse facebook log in fails returning a null user. 之后,无论我运行的是哪个用户或运行哪个版本的应用程序,parse facebook登录均无法返回空用户。

Ok, I found the what the issue WAS... 好的,我发现了问题所在...

They way I had the code, it would ask for facebook permissions several times, and that would somehow mess up the user on facebook 他们以我拥有代码的方式,它将多次询问Facebook权限,这将以某种方式使用户在Facebook上混乱

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM