We are using access token from okta and to access okta resource we need to generate and sign a JWT
For testing purpose okta documentation suggest to use below tool to get JWT. In this we enter the private key and Payload to get JWT
How can we achieve it in Apigee ?
The documentation also suggest to use below code to get JWT, but this code does not work in apigee
PrivateKey privateKey = // Load an RSA private key from configuration
Instant now = Instant.now();
String jwt = Jwts.builder()
.setAudience("https://${yourOktaDomain}/oauth2/default/v1/token")
.setIssuedAt(Date.from(now))
.setExpiration(Date.from(now.plus(5L, ChronoUnit.MINUTES)))
.setIssuer(clientId)
.setSubject(clientId)
.setId(UUID.randomUUID().toString())
.signWith(privateKey)
.compact();