Comments (6)
What error? Turn on logging and also capture a network trace.
from aspnetkatana.
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.
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.
See this comment about Fields:
#38 (comment)
from aspnetkatana.
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.
I was able to use the new version . Thanks for the help.
from aspnetkatana.
Related Issues (20)
- Could not load file or assembly Microsoft.Live.Base exception HOT 3
- Unauthorized error 401.0 for Asp.net mvc site with IIS anonymous authentication HOT 8
- /signin-oidc is not found HOT 7
- 'OwinStartupAttribute' is inaccessible due to its protection level HOT 3
- GetExternalLoginInfoAsync() return null for facebook only HOT 6
- Having vulnerabilities on Microsoft.Owin.Security.OpenIdConnect, 4.2.2 HOT 2
- ClockSkew Ignored by OAuthBearerAuthenticationHandler HOT 2
- Requests are run on IOCP threads by default in OwinHttpListener HOT 5
- Attempt to access method System.Management.Instrumentation.InstrumentedAttribute..ctor(System.String) in violation of security transparency rules failed. HOT 2
- Question: Why does the 4.2.2 package specifically require .NET Framework 4.5? HOT 2
- System.NullReferenceException: Object reference not set to an instance of an object HOT 9
- App redirects to different Auth Type refresh token URL. HOT 4
- Strange behavior on port 50000 for Owin self hosting.... HOT 8
- OpenIdConnectProtocolValidator cannot validate state HOT 4
- Should OIDC middleware be refreshing a `code id_token` when close to expiry? HOT 3
- Session in ASP.NET WebForm is cleared after authenticated by Entra ID with CookieAuthentication and WsFederationAuthentication HOT 2
- Always a object reference error when trying to host a webapi in owin self hosted HOT 3
- owin.RequestId always empty guid string HOT 3
- Microsoft.Owin.Security.WsFederation has a vulnerable Newtonsoft.Json package dependency HOT 10
- how do you remove additional query parameters HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspnetkatana.