public override ClaimsIdentity ProcessSignInResponse(string realm, string originalUrl, HttpContextBase httpContext)
        {
            var client = new FacebookClient(this.applicationId, this.secret);

            AuthenticationResult result;
            try
            {
                result = client.VerifyAuthentication(httpContext, this.MultiProtocolIssuer.ReplyUrl);
            }
            catch (WebException wex)
            {
                throw new InvalidOperationException(new StreamReader(wex.Response.GetResponseStream()).ReadToEnd(), wex);
            }

            var claims = new List<Claim>
                {
                    new Claim(System.IdentityModel.Claims.ClaimTypes.NameIdentifier, result.ExtraData["id"])
                };

            foreach (var claim in result.ExtraData)
            {
                claims.Add(new Claim("http://schemas.facebook.com/me/" + claim.Key, claim.Value));
            }

            return new ClaimsIdentity(claims, "Facebook");
        }
        /// <summary>
        /// Registers a supported OAuth client with the specified consumer key and consumer secret.
        /// </summary>
        /// <param name="client">One of the supported OAuth clients.</param>
        /// <param name="consumerKey">The consumer key.</param>
        /// <param name="consumerSecret">The consumer secret.</param>
        public static void RegisterOAuthClient(BuiltInOAuthClient client, string consumerKey, string consumerSecret)
        {
            IAuthenticationClient authenticationClient;
            switch (client)
            {
                case BuiltInOAuthClient.LinkedIn:
                    authenticationClient = new LinkedInClient(consumerKey, consumerSecret);
                    break;

                case BuiltInOAuthClient.Twitter:
                    authenticationClient = new TwitterClient(consumerKey, consumerSecret);
                    break;

                case BuiltInOAuthClient.Facebook:
                    authenticationClient = new FacebookClient(consumerKey, consumerSecret);
                    break;

                case BuiltInOAuthClient.WindowsLive:
                    authenticationClient = new WindowsLiveClient(consumerKey, consumerSecret);
                    break;

                default:
                    throw new ArgumentOutOfRangeException("client");
            }
            RegisterClient(authenticationClient);
        }
 public override void ProcessSignInRequest(Scope scope, HttpContextBase httpContext)
 {
     var facebook = new FacebookClient(this.applicationId, this.secret);
     facebook.RequestAuthentication(httpContext, this.MultiProtocolIssuer.ReplyUrl);
 }
 // GET: /Accounts/Facebook
 public ActionResult Facebook()
 {
     var facebookClient = new FacebookClient("appId", "appSecret");
     return Authenticate(facebookClient);
 }