MVC 5 App with Facebook, and Google OAuth2 Sign-onhttp://www.asp.netMon, 30 Sep 2013 16:14:54 GMTumbracoComments for MVC 5 App with Facebook, and Google OAuth2 Sign-onenComment Posted by jats_ptlhttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onThu, 27 Jun 2013 20:03:40 GMT00000000-0000-0000-0000000019418Good Article to start with MVC 5.....Great Work!!!:)]]>Comment Posted by ricka0http://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onMon, 01 Jul 2013 18:34:21 GMT00000000-0000-0000-0000000019461@jats_ptl Thanks for the feedback. Let me know what you'd like to see in the next version.]]>Comment Posted by samthemanhttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onTue, 02 Jul 2013 11:56:43 GMT00000000-0000-0000-0000000019468Once logged in the user never gets logged out even after 24 hours and re-booting, unless the user explicitly logs out. . Is this by design? (if so what's the reason?

(I notice the AspNet.External and ASPNet.Application cookies persist across browser session and re-boots)

Is there a way to force the user to login on a new session?

]]>Comment Posted by MrSimArtghttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onThu, 11 Jul 2013 19:05:04 GMT00000000-0000-0000-0000000019549How much of this isn't possible to do in VS2012+update3?

I'm trying to get the user data (email, gender, date of birth, etc). Is there a way to get this using Claims Identity and without using the FacebookAPI?

Thanks

]]>Comment Posted by Vito.DeCarlohttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onSun, 28 Jul 2013 23:45:55 GMT00000000-0000-0000-0000000019697Excellent article! I'm actually trying to create a custom membership system, but it's failing at registering a new local user. I've simplified my code and posted it to StackOverflow, so instead of posting it all here, I'll provide the URL to the full question.

]]>Comment Posted by peterloudonhttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onFri, 23 Aug 2013 14:50:27 GMT00000000-0000-0000-0000000019996Rick, do you have or do you plan on creating a tutorial for deploying an MVC 5 application to Azure using EF code-first migrations for the Membership / Account functionality? (Or is there already an example I have not spotted?)

]]>Comment Posted by nguyenquyhyhttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onWed, 11 Sep 2013 13:03:19 GMT00000000-0000-0000-0000000020171I would like to query a user by user ID (get from System.Web.HttpContext.Current.User.Identity.GetUserId();) and get the ApplicationUser object.

I have tried to access the data context directly but the Users DbSet is always empty. Is there a way to do that?

]]>Comment Posted by citriusjohnhttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onFri, 13 Sep 2013 15:59:00 GMT00000000-0000-0000-0000000020194Hi Rick, great article. I'm trying to add additional properties to the Web API AccountController/ApplicationOAuthProvider of the new RC SPA template. I am also trying to add properties to the local user, not external, and on the registration form, not confirmation.

I figured out most of the differences, but it seems that you cannot add additional user properties before registration. I'm stuck at CreateLocalUserAsync throws an error when passed ApplicationUser (rather than just User).

My MvcAuth project works on the localhost with Google authentication, but not as an Azure website. The Google button returns: "An error occurred while processing your request."

]]>Comment Posted by edpantaleonehttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onSat, 14 Sep 2013 17:31:30 GMT00000000-0000-0000-0000000020206My MvcAuth project does works with Azure. I created the website with a database and defined the ApplicationDbContext using the VS2013 publishing settings. It works very well. Thank you.

I've been playing around with using Facebook as an external authentication provider. So far I managed to get Facebook to request permission for additional scope data (email, user_birthday) by passing passing my own FacebookAuthenticationOptions to app.UseFacebookAuthentication() in Startup.Auth.cs. Unfortunately I'm unable to retrieve the values returned by Facebook.

Can you maybe extend the above sample showing how to use additional scope data from Facebook?

Thanks for the pointer to the Facebook sample. I've made some progress since and am now able to retrieve and store Facebook data in an (extended) AspNetUsers table.

What I'm missing in this blog is how to update a custom user after registration. It would be nice if you could extend your sample code so the user could change his home town after authentication. Or maybe you have planned another blog on how to do this?

]]>Comment Posted by citriusjohnhttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onSat, 21 Sep 2013 12:53:06 GMT00000000-0000-0000-0000000020292I have posted an example of how to enable users to update the custom properties created in this example using the Identity EF User Store. This is my best guess of how it is intended that you utilize the new Identity model. Please feel free to comment/contribute/criticize it on GitHub:

Just a question, when you use this User management, how your business application table refer to [AspNetUsers]? By the ID (So you have GUID everywhere :()? By UserName? By a new ApplicationUser property in int?

]]>Comment Posted by xxCaseyhttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onMon, 30 Sep 2013 15:08:15 GMT00000000-0000-0000-0000000020346When I run a migration a discriminator column is added. Then when I try to register a user the application will not save because, it can not figure out the discriminator. What is the fix for this?

Also should the User account data be in a different context then other models such as dog or car?

]]>Comment Posted by xxCaseyhttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onMon, 30 Sep 2013 16:12:35 GMT00000000-0000-0000-0000000020348So I'm not 100% sure of what is going on but to partially answer my own first question. If someone only does the google portion of this tutorial and then updates there database then when they try to add a user the app will fail because of the discriminator. But if you continue to the facebook section the app will save. I believe this is because ApplicationUser needs its own columns to be considered different from you user to make a discriminator. Also I may of missed it but but the viewmodel for]]>Comment Posted by xxCaseyhttp://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-onMon, 30 Sep 2013 16:14:54 GMT00000000-0000-0000-0000000020349RegisterViewModel should be updated with public string HomeTown { get; set; }