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
RestClient::BadRequest: 400 Bad Request
Tags: rest api
May 1, 2017 at 12:56pm   •   1 replies  •  0 likes
jordan-graft

I am getting a RestClient::BadRequest: 400 Bad Request when hitting the endpoint "/restapi/oauth/token"


Here is my code.


 def get_new_tokens                   url = "#{BASE_URL}/restapi/oauth/token"
  hash = {
  
   grant_type: "password",
   username: username,
   password: password,
   extension: extension
  }
  response = JSON.parse(RestClient.post(url, hash, self.class.headers))
  puts response
  self.update(
   access_token: response['access_token'],
   refresh_token: response['refresh_token'],
   expires_at: DateTime.now + response['expires_in'].seconds,
   refresh_token_expires_at: DateTime.now + response['refresh_token_expires_in'].seconds,   
  )
 end  


I cant figure out what the issue is. I am not getting any description back on the 400 error. Any help would be much appreciated.

1 Answer
answered on May 1, 2017 at 5:27pm  
Could you please post the message body? HTTP status code alone is not very helpful.

By the way, are you using any SDK or writing HTTP code yourself?

 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