0

the default request parameters to get new JWT using refresh token are: grant_type , refresh_token and client_id .

I need to control the claims identity modification by adding new body parameter when requesting a new refresh token.

let say the parameter is named by grant_claims, which can hold true or false boolean value.

how can I get that custom parameter in the GrantRefreshToken() overridden method?

Many Thanks

AbuDawood
  • 745
  • 7
  • 22

1 Answers1

2

Finally, I found the answer from this post :

owin oauth send additional parameters

in the ValidateClientAuthentication we can add additional params

public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
        {
   // other code ...
       var grantClaims = context.Parameters.Get("grant_claims");
    // other code ...
        context.OwinContext.Set<string>("grant_claims", grantClaims);
    // other code ...
}

then get the values in the authentication and refresh token methods

// auth
 public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            var grantClaims = context.OwinContext.Get<string>("grant_claims");

}

//refresh token
public override async Task GrantRefreshToken(OAuthGrantRefreshTokenContext context)
        {
var grantClaims = context.OwinContext.Get<string>("grant_claims");
}
AbuDawood
  • 745
  • 7
  • 22