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
400 and Invalid Resource owner credentials
Tags: developer sandbox
Dec 1, 2022 at 8:57am   •   1 replies  •  0 likes
Jacob Lafrance

I've tried multiple credential combinations. I've recreated multiple sandbox apps just to make sure I was setting them up correctly.

The only thing I think may be conflicting is the Company Main Number in my develoepr account is different than the phone number (username) that has been assigned to my apps.

Environment: sandbox

Main Company Number: +1629235xxxx

Apps Phone number (username): +1267299xxxx

When I use the +1267299xxxx number in the API Reference docs 'Try it out'. I get the json response just fine. When I try to make the request using python SDK it give the following.


Traceback (most recent call last):
File "/home/user/repos/flask-api/fapi/lib/python3.10/site-packages/ringcentral/http/client.py", line 28, in send
response.response().raise_for_status()
File "/home/user/repos/flask-api/fapi/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://platform.devtest.ringcentral.com/restapi/oauth/token

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/user/repos/flask-api/PassFlowringcentral-CallLogPull.py", line 15, in <module>
requests.login(env.get('USERNAME'), env.get('EXTENSION'), env.get('PASSWORD'))
File "/home/user/repos/flask-api/fapi/lib/python3.10/site-packages/ringcentral/platform/platform.py", line 127, in login
raise e
File "/home/user/repos/flask-api/fapi/lib/python3.10/site-packages/ringcentral/platform/platform.py", line 121, in login
response = self._request_token(TOKEN_ENDPOINT, body=body)
File "/home/user/repos/flask-api/fapi/lib/python3.10/site-packages/ringcentral/platform/platform.py", line 194, in _request_token
return self.send_request(request, skip_auth_check=True)
File "/home/user/repos/flask-api/fapi/lib/python3.10/site-packages/ringcentral/platform/platform.py", line 170, in send_request
return self._client.send(self.inflate_request(request, skip_auth_check=skip_auth_check))
File "/home/user/repos/flask-api/fapi/lib/python3.10/site-packages/ringcentral/http/client.py", line 34, in send
raise ApiException(response, e)
ringcentral.http.api_exception.ApiException: Invalid resource owner credentials


I am not sure what to do next as the credentials I know are correct. Maybe the URL?

1 Answer
answered on Dec 1, 2022 at 9:23am  

First of all, this number +1629235xxxx is not your sandbox main company number. It is a "fake" production number for your developer account and the number has nothing to do with your sandbox account.

This number +1267299xxxx is your sandbox account main company number. You can use it as a username to login the sandbox service web or authenticate your app with a proper password. Since it is a main company number, it defaults to the 101 extension (if omitted and not changed the default ext number). The mystery in your question is how you call the login in your Python code and you did not post any code for me to see what could be wrong. This is an example of how to login using username and password in Python using the RingCentral Python SDK

from ringcentral import SDK
from credentials import *

rcsdk = SDK( "Your-App-ClientId", "Your-App-ClientSecret", "https://platform.devtest.ringcentral.com")
platform = rcsdk.platform()
platform.login("Main-Company_Number", "Extension-Number", "Password")

Please check and share some code (remember to remove sensitive info) if you still face problems.


 0



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