Question

I am using Social Connector Module to Integrate Facebook Login.

How can I integrate this into a page which will be shown to any user when he browses the site for any page and once he logs in with his Facebook credentials, the requested page of the site will be shown.

No correct solution

OTHER TIPS

If I understand correctly, you want to make sure they are logged in through Facebook before showing any content?
After having a quick browse through the Administrators and Developers guide I think you should be able to use a Sitecore Rule.

Your Condition would be where the current user is connected to the specific social network, where you set 'specific' to Facebook. This rule comes with the module. Your (custom) Action could be something like 'Set context item to specific item', where specific item is your login page (keep in mind that you probably want to exclude that page for running the Rule to prevent infinite loops, assuming your login page is also in Sitecore).

All that's left then is to kick off the rule on page load. To see how Sitecore does this for it's ConditionalRenderingsRules you can use Reflector, and disassemble the Evaluate method in Sitecore.Pipelines.InsertRenderings.Processors.EvaluateConditions.

You could also achieve this through code:

    private void Page_Load(object sender, EventArgs e)
        {
            string fbId;
            if (Request.QueryString["authResult"] != null && IsFacebookLogin(out fbId))
            {
                var facebookDataItem = Sitecore.Context.Database.GetItem("/sitecore/content/Home/FacebookData");
                Response.Redirect(facebookDataItem.Paths.Path.Replace(facebookDataItem.Paths.ParentPath, ""));
            }
        }

public bool IsFacebookLogin(out string fbId)
        {
            fbId = string.Empty;
            if (!Sitecore.Context.User.IsAuthenticated) return false;

            fbId = Sitecore.Context.User.Profile.GetCustomProperty("fb_id");
            return !string.IsNullOrEmpty(fbId);
        }

In this case, i am doing a redirect if the user is logged in using a facebook ID. You could also take a look at this blog post for more details on the setup & usage of the module: Social Connected with Sitecore (Facebook) 1: Setup, Posting messages on content publish & trigger of DMS goals

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top