Page tree
Skip to end of metadata
Go to start of metadata

The basic authentication methods do not provide access to the PeopleToken that is created for the initial authentication. Instead, the relevant values are stored in an AuthenticationResult object in the WWClient. However, there may be scenarios where you want to store the PeopleToken in a database or long-term cache. To do this, additional methods have been added to the WWAuthenticationEndpoint class.

  • WWauthenticationEndpoint.authorizeUserGetToken(String basicAuthApp, String userToken, String url) allows you to perform an initial authentication with the user's token and return the PeopleToken.
  • WWAuthenticationEndpoint.authorizeUserRefreshTokenGetToken(String basicAuthApp, String refreshToken, String scope) allows you to re-authenticate with the refreshToken and return the PeopleToken.

Security Warning

If you are storing the PeopleToken somewhere, ensure you properly encrypt the token because it will include all credentials required to run as the user and re-authenticate when the token expires.

You need to pass the Base64 encoded application credentials to the method. The easiest way to do that is to pass the appId and appSecret to a WWClient object and use the getAppCredentials() method. You can then pass those credentials, the initial user token and the scope to use.

Output Refresh Token
@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());
}

If you're storing the token, you will need to manually refresh and get the updated PeopleToken when it's due to expire.

Refresh
    public PeopleToken refresh() throws WWException, UnsupportedEncodingException {
        WWAuthenticationEndpoint ep = new WWAuthenticationEndpoint();
        PeopleToken token = ep.authorizeUserRefreshTokenGetToken(appCredentials, token.getRefresh_Token(), token.getScopeAsString());
        return token;
    }

5 Comments

  1. Anonymous

    Awesome! This is a good change because the users can, now, make it easy. People always want to fix the bugs and this time they will enjoy. We look forward to more enhancements to ease the use. Make it more simple and effective like how cheap essay writers deal with complicated papers. The users do not want to spend more time on searching for tools. They need everything at one place. Thank you for the update and I appreciate the information shared.

  2. Anonymous


    Those are valuable tips for running a user with a stored people Token. If you are searching for people token. You can use a bunch of tips to manage your work by following the above method. Our company Thesis writing Service deals with problems of PhD students who face problems to deal with them.

  3. Anonymous

    Your blog site is so superb. How fortunate to see everything you have created. I hope you proceed to do the job tough. I am the best Dubai Mobile App Developer, well known for mobile application development. I am always working on the latest technology and create Advanced IOS and Android apps.

  4. Anonymous

    What an amazing post you are sharing here. I am really wonder reading this and welcome method of writing an article. You are always sharing some quality content for us like this post, that why we are always like your posts. I hope you are continuing writing fabulous and informative article for us. I would like you to recommend high quality essay content from cheap essay writing service ; it is helpful to students who are studying in higher studies. Once again I thankful to your post. 

  5. Anonymous

    This is an excellent post. Great resource indeed. 

    LAYOUTindex 

    Website 

    Resource 
    Solis Hotel 

Write a comment…