Sandbox happy, now porting to Production..

  • 1
  • Problem
  • Updated 2 years ago
  • Solved
I been playing around the API for sometime now and I'm happy with what i got.

Now, I'm trying to port to the production server but right away, I'm having problem trying to login.

I'm using Advance REST client and the Authentication modal dialog doesn't go away. (keeps failing. I keep getting the following.

{
"error": "invalid_client"
"error_description": "Access Denied."
}

I tried again with my Sandbox credential and it works fine. 

I've double check the URL for both server and double check the endpoints but to no avail.

Please help.

Thanks.
Photo of Ted Butler

Ted Butler

  • 242 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
Photo of AK

AK, Official Rep

  • 4,372 Points 4k badge 2x thumb
Hi Ted,

Could you use the AppKey and AppSecret issued against your Production Environment.

Find your application key and secret by Navigating to My Account -> Applications -> Application Name. Use Production Application key and secret.

Let us know if you are able to authenticate.

Photo of Ted Butler

Ted Butler

  • 242 Points 100 badge 2x thumb
I did.. that is one of the things i have to re-encode for the production server.

I just confirmed the base64 hash of the keys just now.
(Edited)
Photo of Benjamin Dean

Benjamin Dean

  • 8,602 Points 5k badge 2x thumb
And your application has applied for and been approved for production access? If you're not sure, visit the Developer Portal and view the "Credentials" section for your application. The API server, app_key, and app_secret are different for production environment, and you must apply to be granted this access.

Are you making sure the username is prefixed with the country code prefix, so for instance if I am in the USA the country code is "1" and the username would be "14445559999"?

Are you using the extension property? If you are and it doesn't match the username you're providing, then I get an invalid_client sometimes.

Are there any spaces before or after your username, extension, or password?

Is the Content-Type header property set to "application/x-www-form-urlencoded"?

Is the Accept header property set to "application/json"?
Photo of Ted Butler

Ted Butler

  • 242 Points 100 badge 2x thumb
Yes, the application has been approved. Will try it again today (with a fresh set of eyes).
Photo of Benjamin Dean

Benjamin Dean

  • 8,602 Points 5k badge 2x thumb
Awesome! Keep us posted on your progress and let us know if you have any more questions.
Photo of Ted Butler

Ted Butler

  • 242 Points 100 badge 2x thumb
I tried. Still get this error.

{
"error": "invalid_grant"
"error_description": "Invalid resource owner credentials."
}

I ignored what i have in the sandbox and followed this guide.

https://developer.ringcentral.com/library/tutorials/get-started.html
(Edited)
Photo of Benjamin Dean

Benjamin Dean

  • 8,602 Points 5k badge 2x thumb
Could you please provide the complete oauth POST request you're sending (please remove your API keys: app_key and app_secret).
Photo of Ted Butler

Ted Butler

  • 242 Points 100 badge 2x thumb
How would i do that? I'm using Advanced REST client
Photo of Ted Butler

Ted Butler

  • 242 Points 100 badge 2x thumb
Figured out the issue.

It has something to with a character in my password.
The offending Character was "+"
Photo of Ted Butler

Ted Butler

  • 242 Points 100 badge 2x thumb
Ok, i got the Authentication part down. Yipee! 

Now, I'm getting error when i try to send an SMS

{
  ["errorCode"]=>
  string(16) "InvalidParameter"
  ["message"]=>
  string(47) "Resource for parameter [accountId] is not found"
  ["errors"]=>
  array(1) {
    [0]=>
    object(stdClass)#3 (3) {
      ["errorCode"]=>
      string(7) "CMN-102"
      ["message"]=>
      string(47) "Resource for parameter [accountId] is not found"
      ["parameterName"]=>
      string(9) "accountId"
    }
  }
  ["parameterName"]=>
  string(9) "accountId"
}

i got [accountId] from  [owner_id] here.
Authentication/Token
{
  ["access_token"]=>
  string(234) "<changed>"
  ["token_type"]=>
  string(6) "bearer"
  ["expires_in"]=>
  int(3599)
  ["refresh_token"]=>
  string(234) "<changed>"
  ["refresh_token_expires_in"]=>
  int(604799)
  ["scope"]=>
  string(62) "ReadPresence ReadMessages ReadCallLog SMS RingOut ReadAccounts"
  ["owner_id"]=>
  string(10) "2602536012"
  ["endpoint_id"]=>
  string(22) "_2rE1bLdSomqUlj-I4Xn4g"
}
(Edited)
Photo of Ted Butler

Ted Butler

  • 242 Points 100 badge 2x thumb
Never mind, I used "~" instead.