Call a Function Handler after Owin Token Authorization in C# -


i use owin on serverside access token. afterwards, send token client server authenticated. want know, how can run function after authorization completed? (i've tried accesstokenprovider -> onreceiveasync didn't not worked properly).

i found answer. it's enough using onreceive instead of onreceiveasync in app start or initiate oauth object, below:

oauthoptions = new oauthauthorizationserveroptions {      tokenendpointpath = new pathstring("/getauthtoken",         provider = new applicationoauthprovider(publicclientid, usermanagerfactory),             authorizeendpointpath = new pathstring("/api/account/externallogin",             accesstokenexpiretimespan = timespan.fromdays(10),             allowinsecurehttp = true,             accesstokenprovider = new authenticationtokenprovider()             {                 onreceive = context =>                 {                     context.deserializeticket(context.token);                     // after can sure ticket initialized , have                     // access user                     if(context.ticket.identity.isauthenticated)                         entitycontext.userid = context.ticket.identity.getuserid();                     else                         entitycontext.userid = "";                 }             } }; 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -