Giter Site home page Giter Site logo

Comments (6)

Tratcher avatar Tratcher commented on July 17, 2024

What error? Turn on logging and also capture a network trace.

#38

from aspnetkatana.

YovavGad avatar YovavGad commented on July 17, 2024

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

from aspnetkatana.

elraider33 avatar elraider33 commented on July 17, 2024

I already review it and this is what i got:
while in the version in the version 3.0.1 the returned values include first name, last name, email and others; in the version 3.1.0 the only returned values are the name and the Id. How can I have the other values?

Regards

from aspnetkatana.

Tratcher avatar Tratcher commented on July 17, 2024

See this comment about Fields:
#38 (comment)

from aspnetkatana.

vpekarek avatar vpekarek commented on July 17, 2024

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, user.Identity has only windowsPrincipal. So user is authenticated in FB, but I can't read user e-mail and other info. Any tips?

from aspnetkatana.

elraider33 avatar elraider33 commented on July 17, 2024

I was able to use the new version . Thanks for the help.

from aspnetkatana.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.