Oauth2 - Get an access token from a refresh token using Java Scribe

161 Views Asked by At

Is there a way to get an access token using Scribe on Java using a previously created refresh_token? My real use case is to access Twitter v2 Apis.

I am able to get a new access token creating a new refresh too with the following code

    final OAuth20Service service = new ServiceBuilder(clientId).apiSecret(clientSecret)
        .defaultScope(scopeBuilder).callback(callback).build(TwitterOAuth20Api.instance());

    OAuth2AccessToken accessToken = service.refreshAccessToken(refreshToken);

This works but it would be much simpler if I could reuse the refresh code later to get another access token. Is that possible?

0

There are 0 best solutions below