Reputation: 5703
For example, client send requests for an access token with the additional field location: USA
. Where can I store that field, which would then passes back to my server from a client? I mean, that field must present in all requests, but certain values can differs.
Example request:
POST /connect/token
formData: {
client_id: 'some_id',
client_secret: 'some_secret',
grant_type: 'client_credentials',
scope: 'some_scope',
location: 'USA'
}
Response:
{
"access_token": "",
"expires_in": 43200,
"token_type": "Bearer"
}
Payload of decoded token
{
"nbf": 1517821102,
"exp": 1517864302,
"iss": "",
"aud": [],
"client_id": "some_id",
"scope": [ "some_scope" ],
"location": 'USA'
}
I am using IdentityServer 4 on ASP.NET Core
Upvotes: 2
Views: 2216
Reputation: 39072
You should be able to implement a custom IProfileService
and set the IssuedClaims
property of the ProfileDataRequestContext
. This should enable you to send custom claims within the access token. See the documentation for more info.
Upvotes: 1