【问题标题】:Sitecore 7.2 Social Connected Module 2.1 authResult=errorSitecore 7.2 社交连接模块 2.1 authResult=error
【发布时间】:2016-09-11 23:43:59
【问题描述】:

我已经在 Sitecore 7.2 上安装了社交连接模块 2.1,然后我配置了个人资料映射、facebook 应用程序,一切都很顺利。

当我尝试使用“使用 facebook 登录”渲染登录时,我会重定向到带有错误查询字符串的同一页面:

http://sc72rev151021.com/registration?authResult=error_9ffsede-dsdf6-4f50-9b6a-asdasdasd

我检查了日志文件,我看到了这个错误:

28144 10:24:36 错误 ConnectManager 中发生错误异常: Sitecore.Social.Infrastructure.Exceptions.SocialException 消息: 字典中没有给定的键。

嵌套异常

异常:System.Collections.Generic.KeyNotFoundException 消息: 字典中不存在给定的键。来源:mscorlib
在 System.Collections.Generic.Dictionary`2.get_Item(TKey key) 在 Sitecore.Social.Facebook.Networks.Providers.FacebookProvider.GetAccountBasicData(帐户 帐户)在 Sitecore.Social.Client.Api.ConnectorClientManager.Connect(帐户 account, Boolean attachAccountToLoggedInUser, Boolean isAsyncProfileUpdate) 在 Sitecore.Social.Client.Api.Connector.ConnectorAuthCompleted.AuthCompleted(AuthCompletedArgs 参数)

然后我重新编译了 DLL,代码在这里崩溃(以下代码 sn-p 来自 Sitecore.Social.Facebook.dll ):

  public AccountBasicData GetAccountBasicData(Account account)
    {
        Assert.IsNotNull(account, "Account parameter is null");
        IDictionary<string, object> accountData = this.GetAccountData(account, "/me");
        if (accountData == null)
        {
            return null;
        }
        string str = string.Concat(accountData["first_name"], " ", accountData["last_name"]);
        AccountBasicData accountBasicDatum = new AccountBasicData()
        {
            Account = account,
            Id = accountData["id"] as string,
            Email = accountData["email"] as string,
            FullName = str
        };
        return accountBasicDatum;
    }

   private IDictionary<string, object> GetAccountData(Account account, string access)
    {
        return this.FacebookRequest(account, access, null, (FacebookClient facebookClient, string feedPath, object inputParams) => facebookClient.Get(feedPath) as IDictionary<string, object>);
    }

有什么想法吗?这个模块是否依赖于弃用的 facebook 键?

谢谢

【问题讨论】:

  • 您能否提供您在尝试登录后被重定向到的 Facebook 页面的 URL?我猜它转移了过时的权限范围。
  • 感谢 Anton 的帮助,首先用户在此页面上 sc72rev151021.com/registration 然后他尝试使用 facebook 渲染登录,然后他将重定向到同一页面 sc72rev151021.com/…
  • 您提到的两个页面之间应该有一个对 Facebook 的中间请求。使用浏览器中的 Fiddler 或网络开发者工具面板来获取它。

标签: sitecore sitecore7 sitecore-social-connected


【解决方案1】:

是的,Sitecore Social Connected 中使用的 Facebook API 已过时。 Facebook scope permissions 列表已更改。我在添加 Facebook 应用程序时遇到了similar issue。我认为“使用 facebook 登录”渲染也会向 Facebook 发送请求,其中包含过时的用户权限列表。

【讨论】:

  • 我做了逆向工程。我得到了 IL 代码(使用 ILDASM),更新了新的权限。从 IL 代码(使用 ILASM)创建新的 dll,它对我有用。
  • 这就是我的想法,我会检查你的帖子。非常感谢!
【解决方案2】:

我的模块也有类似的问题,它是由用于社交 API 请求的过时 SSL 版本引起的。 Sitecore 支持提供了解决此问题的修复程序。

【讨论】:

    【解决方案3】:

    这个问题的解决方法如下:

    1. 使用任何 .net 反射器,打开 Sitecore.Socail.Facebook.Dll,从源代码创建一个项目。
    2. 通过添加所需的引用来修复项目中的错误。
    3. 转到 FacebookProvider.cs 中的 GetAccountBasicData 这个函数
    4. 去掉函数内部的代码,改成下面的代码。

      字符串项; Assert.IsNotNull(account, "账户参数为空");

          IDictionary<string, object> accountData = this.GetAccountData(account, "/me");
          if (accountData == null)
          {
              return null;
          }
          string str = string.Concat(accountData["name"]);
          AccountBasicData accountBasicDatum = new AccountBasicData()
          {
              Account = account,
              Id = accountData["id"] as string
          };
          AccountBasicData accountBasicDatum1 = accountBasicDatum;
          if (accountData.ContainsKey("email"))
          {
              item = accountData["email"] as string;
          }
          else
          {
              item = null;
          }
          accountBasicDatum1.Email = item;
          accountBasicDatum.FullName = str;
          return accountBasicDatum;
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多