how to get KeyID (KID) in JWT

Rock Hitman 46 Reputation points
2021-11-27T23:29:01.26+00:00

Hi, I need to send below paramters as request hitting external Restful service
But I am not sure/ dont know from where do I get the information of 'kid' to be passed in the input as Header parameter.

Can anyone pls advice

header
{
"kid": "Gb389a-9f76-gdjs-a92j-0242bk94356",
"alg": "PS256"
}

//PAYLOAD
{
"iss": "b99d9297-9d99-1sh2-a8b3-0301jh130828",
"sub": "b99d9297-9d99-1sh2-a8b3-0301jh130828",,
"aud": "https://platform.geico.ins.io",
"exp": 1410871077,
"nbf": 1410871077,,
"iat": 1410871077,,
"jti": "h6734251-8d43-1sh2-a9v1-0242ac130003",
"scope": "profile-search"
}

Microsoft BizTalk Server
Microsoft BizTalk Server
A family of Microsoft server products that support large-scale implementation management of enterprise application integration processes.
363 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,843 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Anita Lad 1 Reputation point
    2021-11-27T23:44:48.09+00:00

    Key Id mainly refers to a Secret that can be retrieved and used to validate the signed JWT.

    • Mostly it is just a random guid that is stored as a secret Id.

    It should be provided by the generator of the JWT so that a Validator can retrieve the correct secret based on the "kid" to validate the signed JWT token.

    This is first time answering a question !

    I hope this helps.


  2. Anita Lad 1 Reputation point
    2021-11-30T10:34:59.453+00:00

    4. TOKEN

    • Whatever the credentials that you require to be authenticated on the target system, should be provided by the target system via Auth/Identity Provider.
    • So looking at you initial token format -

    header
    {
    "kid": "Gb389a-9f76-gdjs-a92j-0242bk94356",

    • Should be exposed by Identity provider. If dynamic, it should provide an end-point to access this details on regular intervals.

    "alg": "PS256"

    • Identity provider should let you know of the algorithm that it supports
      }

    //PAYLOAD
    {
    "iss": "b99d9297-9d99-1sh2-a8b3-0301jh130828",

    • Mainly related to the target system. Identity provider will make sure that the issuer is the target service.

    "sub": "b99d9297-9d99-1sh2-a8b3-0301jh130828",

    • The subject that Client and Target API have been agreed upon

    "aud": "https://platform.geico.ins.io",

    • Target Service URL

    "exp": 1410871077,

    • Expiry of the token. Mainly inline with the expiry of the Access token

    "nbf": 1410871077,

    • Not Before: Optional (find out from Identity Provider if required)

    "iat": 1410871077,

    • Issued At : Optional (find out from Identity Provider if required)

    "jti": "h6734251-8d43-1sh2-a9v1-0242ac130003",

    • Jwt token ID: Optional (find out from Identity Provider if required)

    "scope": "profile-search"

    • Client API to request the particular operation. (Ask Target Service for available values)
      }

  3. AgaveJoe 28,036 Reputation points
    2021-12-01T00:33:35.74+00:00

    Can you clarify what you are trying to do? Are you building a token server? Are you trying to build a REST API and need to validate a PS256 signature? Are you building a client and need help getting the access token? Are you building a proxy?

    When you say the token changes do you mean the token is not deterministic due to the PS256 signature?


  4. AgaveJoe 28,036 Reputation points
    2021-12-01T14:49:20.983+00:00

    The example shows the grant type is client_credentials using JWT Bearer Token Profile for OAuth 2.0 Client Authentication. The client_assertion is a JWT used to authenticate the client. The identity provider you are using should have documentation that explains how to get or populate client assertation JWT.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.