-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
facebook login still failing #52
Comments
What error? Turn on logging and also capture a network trace. |
Make sure all the Microsoft.Owin DLLs were updated to the new version, and check the version of the DLLs in your final bin folder |
I already review it and this is what i got: Regards |
See this comment about Fields: |
Hi, I don't have problem with authentication from Facebook, but I have problem with reading identities, when I am getting back to my pages. I have code like this: var ctx = Context.GetOwinContext();
var user = ctx != null ? ctx.Authentication.User : new ClaimsPrincipal();
if (user != null && user.Identities.Count() > 0 && user.Identity.IsAuthenticated && string.IsNullOrEmpty(loginProvider))
{
var claimsPrincipal = new ClaimsPrincipal(user.Identity);
Thread.CurrentPrincipal = claimsPrincipal;
var identity = (ClaimsPrincipal)Thread.CurrentPrincipal;
if (identity.Claims.Count() > 0)
{
switch (identity.Claims.First().OriginalIssuer)
{
case "Facebook":
if (!featureExternalLoginFacebook) { break; }
id = identity.Claims.Where(c => c.Type == "urn:facebook:id").Select(c => c.Value).SingleOrDefault();
name = identity.Claims.Where(c => c.Type == ClaimTypes.Name).Select(c => c.Value).SingleOrDefault();
accessToken = identity.Claims.Where(c => c.Type == "FacebookAccessToken").Select(c => c.Value).SingleOrDefault();
var url = string.Format("https://graph.facebook.com/v2.5/{0}?fields=email,first_name,last_name&access_token={1}", id, accessToken);
var req = WebRequest.Create(url);
req.Method = "GET";
req.ContentType = "application/json";
using (var res = new StreamReader(req.GetResponse().GetResponseStream()))
{
dynamic result = Newtonsoft.Json.JsonConvert.DeserializeObject(res.ReadToEnd());
if (result.id != null && result.id == id)
{
email = result.email != null ? result.email : string.Empty;
firstName = result.first_name != null ? result.first_name : string.Empty;
lastName = result.last_name != null ? result.last_name : string.Empty;
}
}
break;
}
externalApp = identity.Claims.First().OriginalIssuer;
if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(email))
{
return true;
}
}
} This worked good before, but now, |
I was able to use the new version . Thanks for the help. |
I upgraded my project to version 3.1.0 and when I try to login with facebook I get an error. My other authentication(google) works fine
The text was updated successfully, but these errors were encountered: