Jacob Lafrance avatar image
Jacob Lafrance asked Phong Vu answered

400 and Invalid Resource owner credentials

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/", line 28, in send
File "/home/user/repos/flask-api/fapi/lib/python3.10/site-packages/requests/", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/user/repos/flask-api/", 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/", line 127, in login
raise e
File "/home/user/repos/flask-api/fapi/lib/python3.10/site-packages/ringcentral/platform/", 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/", 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/", 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/", 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?

developer sandbox
1 |3000

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

1 Answer

Phong Vu avatar image
Phong Vu answered

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", "")
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.

1 |3000

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