oauth - Enrich ASP.Net bearer token format -
oauth - Enrich ASP.Net bearer token format -
i have setup asp.net webapi project back upwards of bearer token this:
var oauthserveroptions = new oauthauthorizationserveroptions { allowinsecurehttp = true, tokenendpointpath = new pathstring("/token"), accesstokenexpiretimespan = timespan.fromdays(1), provider = new simpleauthorizationserverprovider() }; var oauthbeareroptions = new oauthbearerauthenticationoptions(); app.useoauthauthorizationserver(oauthserveroptions); app.useoauthbearerauthentication(oauthbeareroptions);
when create request token endpoint have reply
{ "access_token":"gst9uwsuesiyhkezr94k4xwuzvnq", "token_type":"bearer", "expires_in":86399 }
is there way enrich token additional fields this?
{ "access_token":"gst9uwsuesiyhkezr94k4xwuzvnq", "token_type":"bearer", "expires_in":86399, "username":"user@mail.com" }
well here solution:
in class inherits oauthauthorizationserverprovider
public override async task tokenendpoint(oauthtokenendpointcontext context) { context.additionalresponseparameters.add("username", "user@mail.com"); homecoming task.fromresult<object>(null); }
asp.net-web-api oauth bearer-token
Comments
Post a Comment