Ideal functionality: A user is logged in and authenticated to website A. They click a button, the backend looks up the ID of the account in website B from the database, then send this information to IdentityServer to create a JWT that contains the "user_id" field. This is then used to call a REST endpoint on website B and is authenticated, then the "user_id" is used to create a log in cookie which is sent back to website A. User is then redirected.
We are running IdentityServer 4, but communicating to it using IdentityServer3 as our main codebase is on .NET Framework. I've tried including the "user_id" field in the extras parameter, but this doesn't appear to do anything.
var client = new TokenClient(requestPath, CLIENT_ID, CLIENT_SECRET,
AuthenticationStyle.PostValues);
var test = new Dictionary<string, string>
{
{ "user_id", "123123" }
};
// request token
var tokenResponse = await client
.RequestClientCredentialsAsync(apiScope, test)
.ConfigureAwait(false);
I've also tried using client.RequestCustomAsync and client.RequestAsync with no luck.
I receive a token without issue, but it doesn't include the user_id information - only the normal audience, scope, expiration times, etc.