public OAuth2AccessToken getToken() { if (token == null) { return null; } if(this.credentials.isRefreshable()) { if (token.getExpiresIn() < 50) { // 50 seconds before expiration? Then refresh it. token = refreshToken(token, credentials.getEmail(), credentials.getPassword(), credentials.getClientId(), credentials.getClientSecret()); } } return token; }
public OAuth2AccessToken getToken() { if (token == null) { return null; } if (this.credentials.isRefreshable()) { if (token.getExpiresIn() < 50) { // 50 seconds before expiration? Then refresh it. token = refreshToken(token, credentials.getEmail(), credentials.getPassword(), credentials.getClientId(), credentials.getClientSecret()); } } return token; }
public void init(CloudCredentials credentials) { if (credentials != null) { this.credentials = credentials; if (credentials.getToken() != null) { this.token = credentials.getToken(); } else { this.token = createToken(credentials.getEmail(), credentials.getPassword(), credentials.getClientId(), credentials.getClientSecret()); } } }
public void init(CloudCredentials credentials) { if (credentials != null) { this.credentials = credentials; if (credentials.getToken() != null) { this.token = credentials.getToken(); } else { this.token = createToken(credentials.getEmail(), credentials.getPassword(), credentials.getClientId(), credentials.getClientSecret()); } } }