RestClient::BadRequest: 400 Bad Request

  • 1
  • Question
  • Updated 2 years ago
  • (Edited)
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(, hash, self.class.headers))
puts response
access_token: response['access_token'],
refresh_token: response['refresh_token'],
expires_at: + response['expires_in'].seconds,
refresh_token_expires_at: + response['refresh_token_expires_in'].seconds,

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.
Photo of Jordan Graft

Jordan Graft

  • 70 Points
  • frustrated

Posted 2 years ago

  • 1
Photo of Tyler Long

Tyler Long, Official Rep

  • 9,828 Points 5k badge 2x thumb
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?