Page tree

Versions Compared


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

If connecting as a user, you will need to relevant user token, as well as the app key and app secret for the application from which the call is being made. The WWClient can be instantiated by calling the static method WWClient.buildClientApplicationAccess(yserTokenuserToken, appId, appSecret, authenticationEndpoint). The userToken is a string value passed back from full authentication via a browser. Once built, the WWClient can be authenticated. Once authenticated, all relevant Watson Work Services calls can be made.

Code Block
titleSample Code Block
  public void getMe() throws WWException, UnsupportedEncodingException {
	// Note, the below values are not valid ones!
    WWClient client = WWClient.buildClientUserAccess("ricoZt", "5c0bf268-c363-4aae-bbec-e2dbebb2fb72", "vKTpM47ST8ME9gQ9iWt_VjknvMCW", new WWAuthenticationEndpoint(), "");
    assert("Paul Withers".equals(me.getDisplayName()));

Authentication as a user returns a PeopleToken which is passed to the authenticationResult property of the WWClient. This includes setting the expiry date for authentication. Subsequent calls using the same WWClient object will check whether the expiry date has passed, in which case it will re-authenticate.