diff --git a/src/main/java/com/github/mc1arke/sonarqube/plugin/almclient/github/v3/RestApplicationAuthenticationProvider.java b/src/main/java/com/github/mc1arke/sonarqube/plugin/almclient/github/v3/RestApplicationAuthenticationProvider.java index ecf5530..7d7875c 100644 --- a/src/main/java/com/github/mc1arke/sonarqube/plugin/almclient/github/v3/RestApplicationAuthenticationProvider.java +++ b/src/main/java/com/github/mc1arke/sonarqube/plugin/almclient/github/v3/RestApplicationAuthenticationProvider.java @@ -78,7 +78,9 @@ public RepositoryAuthenticationToken getInstallationToken(String apiUrl, String Instant issued = clock.instant().minus(10, ChronoUnit.SECONDS); Instant expiry = issued.plus(2, ChronoUnit.MINUTES); - String jwtToken = Jwts.builder().setIssuedAt(Date.from(issued)).setExpiration(Date.from(expiry)) + Date createdDate = new Date(); + Date expirationDate = new Date(createdDate.getTime() + 120 * 1000); + String jwtToken = Jwts.builder().setIssuedAt(createdDate).setExpiration(expirationDate) .claim("iss", appId).signWith(createPrivateKey(apiPrivateKey), SignatureAlgorithm.RS256).compact(); Optional repositoryAuthenticationToken = findTokenFromAppInstallationList(getV3Url(apiUrl) + "/app/installations", jwtToken, projectPath);