I am following the documentation as provided in
https://developer.atlassian.com/static/connect/docs/concepts/understanding-jwt.html#create to create a new JWT token.
Below is a snippet of my code
JwtJsonBuilder jwtBuilder = new JsonSmartJwtJsonBuilder()
.issuedAt(issuedAt)
.expirationTime(expiresAt)
.issuer(key);
CanonicalHttpUriRequest canonical = new CanonicalHttpUriRequest(method, apiPath, contextPath, new HashMap());
JwtClaimsBuilder.appendHttpRequestClaims(jwtBuilder, canonical);
JwtWriterFactory jwtWriterFactory = new NimbusJwtWriterFactory();
def jwtbuilt = jwtBuilder.build();
String jwtToken = jwtWriterFactory.macSigningWriter(SigningAlgorithm.HS256, sharedSecret).jsonToJwt(jwtbuilt);
String apiUrl = baseUrl + apiPath + "?jwt=" + jwtToken;
return apiUrl;
However, I get the error Caused by NoSuchMethodError: com.nimbusds.jose.crypto.MACSigner.<init>(Ljava/lang/String;)V
I noticed that the com.nimbusds.jose.crypto.MacSigner requires a byte[] array in it's constructor while the NimbusJwtWriterFactory in com.atlassian.jwt is passing a String. Any help?
Cheers
Bhushan