Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleOutput Refresh Token
collapsetrue
@Test
public void getToken() throws WWException, UnsupportedEncodingException {
    WWClient client = WWClient.buildClientUserAccess(null, "5c0bf268-c363-4aae-bbec-e2dbebb2fb72", "vKTpM47ST8ME9gQ9iWt_VjknvMCW", null, null);
    String appCredential = client.getAppCredentials();
    WWAuthenticationEndpoint ep = new WWAuthenticationEndpoint();
    PeopleToken token = ep.authorizeUserGetToken(appCredentials, "ricoZt", "https://openntf.org);
    WWClient altClient = WWClient.buildClientUserAccessFromToken("5c0bf268-c363-4aae-bbec-e2dbebb2fb72", "vKTpM47ST8ME9gQ9iWt_VjknvMCW", token);
    System.out.println(altClient.getExpireDate());
    System.out.println(altClient.getUserRefreshToken());
}

...

Code Block
languagejava
titleRefresh
collapsetrue
    public PeopleToken refresh() throws WWException, UnsupportedEncodingException {
        WWAuthenticationEndpoint ep = new WWAuthenticationEndpoint();
        PeopleToken token = ep.authorizeUserRefreshTokenGetToken(appCredentials, token.getRefresh_Token(), token.getScopeAsString());
        return token;
    }