Skip to main content
Question

Java example of oauth with refresh tokens

  • November 9, 2021
  • 3 replies
  • 469 views

We have created a method the does the oauth authentication but it will not persist. Can anyone give me a Java example of one? Here is what I have so far.

@Bean(name="ring-central-rest-config")

public RestClient buildRingCentralRestClientUrl() {

RestClient rc = new RestClient(ringCentralClientId, ringCentralClientSecret, ringCentralServerUrl, getOkHttpClient(this.env));

try {

rc.authorize(accountId, extension, password);

}

catch (IOException | RestException e) {

logger.info("error in calling ring central rest client" + e.getMessage());

}

return rc;

}

3 replies

  • November 10, 2021

screen-shot-2021-11-09-at-50629-pm.pngHi Scott,

Can you share the full log of the resulting exception so we can understand the exact cause of it? Also, did you set "Issue Refresh Tokens" to "Yes" for your app in the developer portal? See attached screenshot of the same.


  • Author
  • New Participant
  • November 10, 2021

Yes, our app is set to Issue Refresh Tokens. I am working on the logs.


PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • November 10, 2021
rc.authorize(accountId, extension, password);

Why accountId? Is that really your account id and where did you get the id? BTW, where did you learn that?

It must be a main company phone number (if you specify the extension number) or the user phone number or the user's email address.