question

Scott Haley avatar image
Scott Haley asked Phong Vu commented

Java example of oauth with refresh tokens

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;

}

oauth
1 comment
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

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.

0 Likes 0 ·
Suyash Joshi avatar image
Suyash Joshi answered

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.


1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Scott Haley avatar image
Scott Haley answered

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

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys