asp.net mvc - Fetching user_birthday from Facebook with MVC 5 -


hello stack overflow friends, need here. trying write basic .net application fun lets users log in through facebook , catpures email , birthday.

in startup.auth.cs use:

var facebookauthenticationoptions = new facebookauthenticationoptions()         {             appid = "foo",             appsecret = "bar",         };         facebookauthenticationoptions.scope.add("email");         facebookauthenticationoptions.scope.add("user_birthday");         facebookauthenticationoptions.signinasauthenticationtype = microsoft.owin.security.appbuildersecurityextensions.getdefaultsigninasauthenticationtype(app);         app.usefacebookauthentication(facebookauthenticationoptions); 

i in controller use:

    if (user != null)     {         await signinasync(user, ispersistent: false);          //get external user data...         var externalidentity = await httpcontext.getowincontext().authentication                .getexternalidentityasync(defaultauthenticationtypes.externalcookie);          var email = externalidentity.findfirstvalue(claimtypes.email);         var birthday = externalidentity.findfirstvalue(claimtypes.dateofbirth);          return redirecttolocal(returnurl);     } 

the email there birthday null. going on? how can capture birthday , other user events?

use externalidentity.findfirstvalue("user_birthday");. claim asking for.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -