I am creating a JWT using the following code:
long now = Instant.now().getEpochSecond();
long exp = now + TimeUnit.HOURS.toSeconds(1);
long nbf = now - TimeUnit.MINUTES.toSeconds(5);
String jwt = Jwts.builder()
.setSubject("d45049c3-3441-40ef-ab4d-b9cd86a17225")
.claim("iss", "d45049c3-3441-40ef-ab4d-b9cd86a17225")
.claim("aud", "https://apporchard.epic.com/interconnect-aocurprd-oauth/oauth2/token")
.claim("jti", UUID.randomUUID().toString())
.claim("exp", exp)
.claim("nbf", nbf)
.claim("iat", now)
.signWith(key, SignatureAlgorithm.RS384)
.compact();
but when I look at the JSON version of the created JWT the header is
{
"alg": "RS384"
}
and it is missing the "typ" field. I thought this field was mandatory.