Registering and Storing External Claims in ASP.NET Identity -
Registering and Storing External Claims in ASP.NET Identity -
i'm using facebook auth , trying register user token claim can't seem work right. able working manually adding in linklogincallback method of manage controller provided default mvc template, approach seems cumbersome , incorrect, in removing , updating token.
i've read can find documentation on lacking , think have code written it's supposed never registers , stores claim in db. solution i'm working @ moment follows in startup.auth:
var fboptions = new facebookauthenticationoptions(); fboptions.scope.add("email"); fboptions.scope.add("user_photos"); fboptions.appid = "[myappid]"; fboptions.appsecret = "[myappsecret]"; fboptions.provider = new facebookauthenticationprovider() { onauthenticated = async context => { context.identity.addclaim( new system.security.claims.claim("facebookaccesstoken", context.accesstoken)); } }; fboptions.signinasauthenticationtype = defaultauthenticationtypes.externalcookie; app.usefacebookauthentication(fboptions);
asp.net-mvc asp.net-mvc-5 asp.net-identity asp.net-identity-2
Comments
Post a Comment