I am trying to add a new parmater to the toekn request.
The goal is to find a workaround to add the user email to the requested token.
var tokenResponse = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
{
Address = disco.TokenEndpoint,
ClientId = "client",
ClientSecret = "secret",
Scope = "api1",
Parameters = { { "user_email", userEmail } }
});
`
But I don’t konw exaclty where to retrive it from the other server.
I have tried
public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{
try
{
if (context.Client.ClientId == "client" && context.Caller == "ClientCredentials")
{
var userEmail = context.ValidatedRequest.Raw.Get("user_email");
if (!string.IsNullOrEmpty(userEmail))
{
context.IssuedClaims.Add(new Claim(JwtClaimTypes.Email, userEmail));
}
return;
}
//Rest of the profile service