Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Robin Hansen 114 posts 245 karma points
    Sep 17, 2020 @ 11:48
    Robin Hansen

    UmbracoIdentity - Facebook login, get profile Pic

    I've successfully installed Shazwazza's UmbracoIdentity package. When a member is registred by their FB account I would like get their Profile Pic along with other datas.

    What I've achieved so far is: ~/App_Start/UmbracoIdentityOwinStartup.cs

    app.UseFacebookAuthentication(new FacebookAuthenticationOptions
                AppId = "xxxxxxxxxx", //Your App Id of course
                AppSecret = "xxxxxxxxxx", //Your App Secret of course
                Scope = { "user_birthday", "public_profile", "email", "user_gender", "user_location" },
                Fields = { "birthday", "picture", "name", "email", "gender", "first_name", "last_name", "location" }, //notice the fields are not prefixed with "user_". This was 
                Provider = new FacebookAuthenticationProvider
                    OnAuthenticated = async ctx =>
                        ctx.Identity.AddClaim(new Claim("FacebookAccessToken", ctx.AccessToken));
                        foreach (var claim in ctx.User)
                            var claimType = string.Format("urn:facebook:{0}", claim.Key);
                            string claimValue = claim.Value.ToString();
                            if (!ctx.Identity.HasClaim(claimType, claimValue))
                                ctx.Identity.AddClaim(new Claim(claimType, claimValue, "XmlSchemaString", "Facebook"));

    What I need to know is how import my FB date into my Umbraco Member ~/Controllers/UmbracoIdentityAccountController.cs ExternalLoginCallback()

                // If the user does not have an account, then create one
            user = new UmbracoApplicationMember()
                Name = loginInfo.ExternalIdentity.Name,
                UserName = loginInfo.Email,
                Email = loginInfo.Email,
                MemberProperties = null, <--- Among others
                MemberTypeAlias = "Candidate"
Please Sign in or register to post replies

Write your reply to: