/** * Refresh this reddit token with data received from the new token. * * @param token Token received from a refresh request to reddit */ public void refresh(OAuthJSONAccessTokenResponse token) { this.accessToken = token.getAccessToken(); this.expiration = currentTimeSeconds() + token.getExpiresIn(); this.expirationSpan = token.getExpiresIn(); this.scopes = new RedditTokenCompleteScope(token.getScope()); this.tokenType = token.getParam(PARAM_TOKEN_TYPE); }
/** * @param token JSON response after an OAuth2 token request */ protected RedditToken(OAuthJSONAccessTokenResponse token) { this.accessToken = token.getAccessToken(); this.refreshToken = token.getRefreshToken(); this.expiration = currentTimeSeconds() + token.getExpiresIn(); this.expirationSpan = token.getExpiresIn(); this.scopes = new RedditTokenCompleteScope(token.getScope()); this.tokenType = token.getParam(PARAM_TOKEN_TYPE); }
public OAuthToken getOAuthToken() { return new BasicOAuthToken(getAccessToken(), getTokenType(), getExpiresIn(), getRefreshToken(), getScope()); }
public OAuthToken getOAuthToken() { return new BasicOAuthToken(getAccessToken(), getTokenType(), getExpiresIn(), getRefreshToken(), getScope()); }
throw new ClientHandlerException("Error while requesting an access token. No 'access_token' found."); if (accessTokenResponse.getExpiresIn() == null) { throw new ClientHandlerException("Error while requesting an access token. No 'expires_in' found."); setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); if (this.accessTokenListener != null) { this.accessTokenListener.notify((BasicOAuthToken)accessTokenResponse.getOAuthToken());