question

PCIC Team avatar image
PCIC Team asked Josie Li commented

Production API credentials used, but oauth call is done to https://platform.devtest.ringcentral.com/restapi/oauth/token

Response: StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Connection: keep-alive X-Application-Context: application:8080 RCRequestId: f653128e-e625-11e9-9732-005056bbcdd9 Pragma: no-cache AceRoutingKey: sjc11-c01-ace11.545acde5-e606-11e9-9962-005056bb6e9b X-HLB-Server: sjc11-c01-hlb11 X-HLB-Connection: 506144065 X-HLB-RequestId: 380d1c46f54662a05742c2a3c947ec0a X-HLB-Upstream-Server: 10.28.21.80:8080 X-HLB-Upstream-Status: 400 Cache-Control: no-store Date: Thu, 03 Oct 2019 21:37:13 GMT Server: nginx WWW-Authenticate: Bearer realm="RingCentral REST API", error="invalid_grant", error_description="Invalid resource owner credentials" Content-Length: 199 Content-Language: en Content-Type: application/json; charset=utf-8 } Content: { "error" : "invalid_grant", "errors" : [ { "errorCode" : "OAU-140", "message" : "Invalid resource owner credentials" } ], "error_description" : "Invalid resource owner credentials" }
Request: Method: POST, RequestUri: ' https://platform.devtest.ringcentral.com/restapi/oauth/token', Version: 1.1, Content: System.Net.Http.FormUrlEncodedContent, Headers: { X-User-Agent: Unknown/0.0.1 RingCentral.Net/2.0.2 Authorization: Basic R1NNVUxRMnhTVGV2RnhaSVFsb0tidzo3WHVwRFY3X1IzeTNPRlBDMWRwRkRBTnFTeWhuOXRTc3lsSnc3RDdtdGJmUQ== Content-Type: application/x-www-form-urlencoded Content-Length: 79 } Content: <content has been disposed by HttpClient: https://github.com/dotnet/corefx/issues/1794>;
rest api
1 |3000

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

Anirban avatar image
Anirban answered PCIC Team commented

The error seems to reflect that your credentials are wrong. What is the URL you are hitting? Is that dev or prod?

Can you please check with developer support and submit a help ticket with your application client id so that they can check the issue?

1 comment
1 |3000

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

PCIC Team avatar image PCIC Team commented ·

We are using the production clientid and client secret provided by RingCentral.

We are using the following code to create the client.

RestClient rc = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, false)

Then the following code to authorize.

TokenInfo tokenInfo = await rc.Authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD);

During the auth, exception is thrown.

0 Likes 0 ·
Phong Vu avatar image
Phong Vu answered Phong Vu commented

I see you are using the RingCentral .NET SDK. To authenticate with the production credentials, change the last param to true.

RestClient rcsdk = new RestClient(PROD_CLIENTID, PROD_CLIENTSECRET, true);
4 comments
1 |3000

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

PCIC Team avatar image PCIC Team commented ·

Thanks Phong! I did switch to

RestClient rc = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, true);

The auth still uses https://platform.devtest.ringcentral.com/restapi/oauth/token to authenticate.

I have sent a request to the developer support team as recommended by @Anirban Sen Chowdhary.

0 Likes 0 ·
PCIC Team avatar image PCIC Team commented ·

I am still facing auth issues. The request is as follows.

Method: POST, RequestUri: 'https://platform.ringcentral.com/restapi/oauth/token', Version: 1.1, Content: System.Net.Http.FormUrlEncodedContent, Headers:
{
  X-User-Agent: Unknown/0.0.1 RingCentral.Net/2.0.2
  Authorization: Basic R1NNVUxRMnhTVGV2RnhaSVFsb0tidzo3WHVwRFY3X1IzeTNPRlBDMWRwRkRBTnFTeWhuOXRTc3lsSnc3RDdtdGJmUQ==
  Content-Type: application/x-www-form-urlencoded
  Content-Length: 79
}
Content: <content has been disposed by HttpClient: https://github.com/dotnet/corefx/issues/1794>
0 Likes 0 ·
PCIC Team avatar image PCIC Team commented ·

App has graduated to production. However it is still active in sandbox. It is confusing.


0 Likes 0 ·
1570145359392.png (21.7 KiB)
Phong Vu avatar image Phong Vu ♦♦ PCIC Team commented ·

When your app is active in the production, it is also still active in the sandbox environment. So don't worry about that because it means you still can test the app in the sandbox at the same time.

1. Make sure to use the client ID and client secret for different environments accordingly.

2. Make sure you login the app with user's credential under each environment correctly.

Your last update showed the correct URL for the production so I am not sure why you can not get authenticated.

'https://platform.ringcentral.com/restapi/oauth/token'


0 Likes 0 ·
Anirban avatar image
Anirban answered

Is this a free tier app?

The last thing now I can guess is being a free tier app.

As per my conversation with the backend dev support team was when I was facing similar kind of issues not able to test the app in production.

What they said was free tier app will not be able to test it using our account and any other RC user (paid user) can test the integration app in production.

Now I hope this is not the case with you.

1 |3000

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

Josie Li avatar image
Josie Li answered Josie Li commented

We have the same issue: cannot login users with the account details configured for production environment. What is the solution for this issue?

2 comments
1 |3000

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

Phong Vu avatar image Phong Vu ♦♦ commented ·

This is normally because of some mistakes in your user credentials, server uri etc. Recommend you to double check them. If you still have problem, create a new thread and provide some some code snippet.

0 Likes 0 ·
Josie Li avatar image Josie Li Phong Vu ♦♦ commented ·

I double checked the credentials and they are correct, I think as we can use it to login the default admin user but no other users. I have started another thread:

https://community.ringcentral.com/questions/90997/user-authorization-failure-with-error-invalid-reso-1.html?childToView=91004#answer-91004

0 Likes 0 ·

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