Sitecore 7.2 Social Connected Module 2.1 authResult=error

246 Views Asked by At

I have installed social connected module 2.1 on Sitecore 7.2, then I configured the profile mapping, facebook app, everything was going well.

When I try to login using the "Login with facebook" rendering, I'm getting redirect to the same page with an error query string:

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

I checked the log file and I see this error:

28144 10:24:36 ERROR The error in ConnectManager occured Exception: Sitecore.Social.Infrastructure.Exceptions.SocialException Message: The given key was not present in the dictionary.

Nested Exception

Exception: System.Collections.Generic.KeyNotFoundException Message: The given key was not present in the dictionary. Source: mscorlib
at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Sitecore.Social.Facebook.Networks.Providers.FacebookProvider.GetAccountBasicData(Account account) at Sitecore.Social.Client.Api.ConnectorClientManager.Connect(Account account, Boolean attachAccountToLoggedInUser, Boolean isAsyncProfileUpdate) at Sitecore.Social.Client.Api.Connector.ConnectorAuthCompleted.AuthCompleted(AuthCompletedArgs args)

Then I recompiled the DLLs, and the code is crashing here (the following code snippet from 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>);
    }

Any Idea ? Is this module depends on deprecated facebook keys ?

Thank you

3

There are 3 best solutions below

0
On BEST ANSWER

The solution for this issue is the following:

  1. Use any .net reflector, open Sitecore.Socail.Facebook.Dll, create a project from the source code.
  2. Fix the errors in the project by adding the required references.
  3. Go to this function GetAccountBasicData in FacebookProvider.cs
  4. Remove the code inside the function, and add the following code instead.

    string item; 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["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;
    
2
On

Yes, Facebook API that is used in Sitecore Social Connected is outdated. Facebook scope permissions list was changed. I faced with similar issue while adding Facebook application. I think that "Login with facebook" rendering also sends request to Facebook with outdated list of user permissions.

0
On

I've had similar issue with the module and it was caused by outdated SSL version used for social API requests. Sitecore support provided a fix which solved this.