Generating Tokens for API Requests

JWT header

{
    "alg": "ES256",
    "kid": "2X9R4HXF34",
    "typ": "JWT"
}

JWT payload

{
    "iss": "57246542-96fe-1a63-e053-0824d011072a",
    "iat": 1528407600,
    "exp": 1528408800,
    "aud": "appstoreconnect-v1",
    "scope": [
        "GET /v1/apps?filter[platform]=IOS"
    ]
}

JWT

{
    "alg": "ES256",
    "kid": "private key",
    "typ": "JWT"
}

I would like to find out how to calculate the "iat" and "exp" for the current time by using swift mathematical calculations if possible.

I want to find out how to sign the JWT with my private key after I download it, to find out how to create a JWT that would receive a HTTP Status Code 200 OK response from the Terminal.App . I received a 401 error not authorized response and to provide a proper JWT token that has not expired after my first attempt on this a application programming interface, I want to find where to place my private key if not in the "kid" ?

Kind Regards

Word salad. What's your actual issue here?

How to create a JWT and sign it with the private key I download ?


![]("https://developer.apple.com/forums/content/attachment/60e9a96b-089d-4a6b-8468-48f66f5cb6f2" "title=Screenshot_20240623-211008.png;width=720;height=1600(https://www.bcgame.com/)))))
Generating Tokens for API Requests
 
 
Q