oauth 2.0 - External login using Identity Server 3 - Setting Given Name claim from facebook -


im trying setup identityserver able login facebook. works fine except cant retrieve of user info facebook.the mvc app expected givenname , lastname claim. have added scope public_profile not back.

after lots of research seems might need setup userservice not sure how this.

help appreciated.

here code configure external providers in statup of idenity server app:

private void configureidenityproviders (iappbuilder app, string signinastype)     {          var facebookoptions = new microsoft.owin.security.facebook.facebookauthenticationoptions         {             authenticationtype = "facebook",             caption = "sign in facebook",             signinasauthenticationtype = signinastype,             appid = "xxxxxxxxxxxx",             appsecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",                provider = new microsoft.owin.security.facebook.facebookauthenticationprovider()             {                 onauthenticated =  (context) =>                 {                      // problem here - there no last_name returned                        jtoken lastname;                     if (context.user.trygetvalue("last_name", out lastname))                     {                         context.identity.addclaim(new system.security.claims.claim(identityserver3.core.constants.claimtypes.familyname, lastname.tostring()));                     }                      context.identity.addclaim(new system.security.claims.claim("role", "guest"));                      return task.fromresult(0);                  }              }         };           facebookoptions.scope.add("public_profile");         facebookoptions.scope.add("email");           app.usefacebookauthentication(facebookoptions);      } 

any claims facebook passed along custom user service's authenticateexternal method. @ point they're claims whatever want with.

if you're not getting claims want facebook, i'd suggest building standalone mvc app problem sorted out first.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -