News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Invalid resource owner credentials Invalid Grant using RestClient
Tags: rest api
Mar 26, 2021 at 8:35am   •   3 replies  •  0 likes
Ashlesha Shirodkar

I have created a sandbox app. I am using RestClient api . With the credentials from my sandbox. Password is my Ringcentral account pasword.

restClient = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER);

restClient.authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD);


I get error on authentication.

AceRoutingKey: sjc11-c01-ace11.1e06d9b3-8c80-11eb-971a-005056bb8878

11:27:09,559 ERROR [stderr] (test task-9) RoutingKey: SJC11P01

11:27:09,559 ERROR [stderr] (test task-9)

11:27:09,559 ERROR [stderr] (test task-9) {

11:27:09,559 ERROR [stderr] (test task-9) "error" : "invalid_grant",

11:27:09,559 ERROR [stderr] (test task-9) "errors" : [ {

11:27:09,559 ERROR [stderr] (test task-9) "errorCode" : "OAU-140",

11:27:09,559 ERROR [stderr] (test task-9) "message" : "Invalid resource owner credentials"

11:27:09,559 ERROR [stderr] (test task-9) } ],

11:27:09,559 ERROR [stderr] (test task-9) "error_description" : "Invalid resource owner credentials"

11:27:09,559 ERROR [stderr] (test task-9) }


Please let me know what is wrong here? I have setup the sanbox as per teh instruction specidfied for password authentication type.

3 Answers
answered on Mar 26, 2021 at 9:21am  

i changed my sandbox password and passing that password but get error when i use RestClient.java


 0
on Mar 26, 2021 at 10:27am   •  0 likes

I looked for a sandbox account with this main company number "+13128589132" and found nothing. I doubt that this is the username for your dev portal, not your sandbox

on Mar 26, 2021 at 10:43am   •  0 likes

RestClient started working now after with new sandbox password. I am now trying to use ok3Http gives 404 error for below url . Basic authentication set in header for {clientid:secretkey}

https://platform.devtest.ringcentral.com/restapi/oauth/token?grant_type=password&username=+13128589132&extension=101&password=#####


on Mar 26, 2021 at 10:48am   •  0 likes

You said RestClient started working and you still have problem to authenticated a user. So what really worked? Are you using the Java SDK?

on Mar 26, 2021 at 10:55am   •  0 likes

RestClient is now working. Since that was not working i also tried making rest call using okhttp. This below code is till giving me 404 response code.

The response code is 404. So i am not sure

on Mar 26, 2021 at 10:55am   •  0 likes

static String RINGCENTRAL_SERVER = "https://platform.devtest.ringcentral.com";

String token="RINGCENTRAL_CLIENTID"+":"+RINGCENTRAL_CLIENTSECRET;

String encodeString = Base64.getEncoder().encodeToString(token.getBytes());

okhttp3.Response response1 = null; try { okhttp3.OkHttpClient client = new okhttp3.OkHttpClient(); String url =RINGCENTRAL_SERVER+"/restapi/oauth/token?grant_type=password&username="+RINGCENTRAL_USERNAME+"&extension="+RINGCENTRAL_EXTENSION+"&password="+RINGCENTRAL_PASSWORD;

okhttp3.Request request1 = new okhttp3.Request.Builder().url(url)

.addHeader("authorization", "Basic " + encodeString).build();

response1 = client.newCall(request1).execute(); int retString = response1.code();

on Mar 26, 2021 at 1:47pm   •  0 likes

Never mind i got it working with oauth too

answered on Mar 26, 2021 at 8:44am  

You said "Password is my Ringcentral account pasword." Do you mean the user name and password you login the RingCentral dev portal at https://developers.ringcentral.com? If that is the case, it is wrong.

You can find our sandbox username from the dev portal by select the "Sandbox Accounts" option.


 0
answered on Mar 26, 2021 at 8:48am  

the user name is phone no. I copied the credentials from the JSON

{"RINGCENTRAL_CLIENTID":"G2IVTQIvRriGGO4QEiIt9Q","RINGCENTRAL_CLIENTSECRET":"Mx8cfv-kRLSpTP0RIB7wfQ43NGUOqjQfWS5_TAjxXU9A","RINGCENTRAL_SERVER":"https://platform.devtest.ringcentral.com","RINGCENTRAL_USERNAME":"+13128589132","RINGCENTRAL_EXTENSION":"101","RINGCENTRAL_PASSWORD":"<YOUR ACCOUNT PASSWORD>"}


What do you mean by Your account password? in credentials it just shows "Active". So i used my Ringcentral account pasword.


 0
on Mar 26, 2021 at 10:25am   •  0 likes

Don't ask me. That was what you wrote

"I have created a sandbox app. I am using RestClient api . With the credentials from my sandbox. Password is my Ringcentral account pasword."



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us