How do you get the Oauth2 AccessToken after its creation from the Owin Api? How do you get the Oauth2 AccessToken after its creation from the Owin Api? asp.net asp.net

How do you get the Oauth2 AccessToken after its creation from the Owin Api?


Sure you can but you need to use Microsoft.Owin.Security.OAuth version 3.0 not 2.1 and then override TokenEndpointResponse in class OAuthAuthorizationServerProvider as the code below

public override Task TokenEndpointResponse(OAuthTokenEndpointResponseContext context)    {        var accessToken = context.AccessToken;        return Task.FromResult<object>(null);    }