use of net.petafuel.styx.core.xs2a.standards.ing.v1_0.http.AccessTokenRequest in project styx by petafuel.
the class STYX09 method generateINGAccessToken.
public void generateINGAccessToken(String url) {
AccessTokenService service = new AccessTokenService();
AccessTokenRequest request = new AccessTokenRequest();
try {
AccessToken retrievedAccessToken = service.tokenRequest(url + "/oauth2/token", request);
// give a tolerance of 30 seconds to the expiry date in case of any software
// related delays
this.accessTokenValidUntil = Instant.now().plusSeconds((retrievedAccessToken.getExpiresIn() - 30));
this.accessToken = retrievedAccessToken;
} catch (BankRequestFailedException e) {
LOG.error("Error getting ing access token:", e);
ResponseEntity responseEntity = new ResponseEntity("Generating ING access token failed", ResponseConstant.INTERNAL_SERVER_ERROR, ResponseCategory.ERROR, ResponseOrigin.STYX);
throw new StyxException(responseEntity);
}
}
Aggregations