question

jordan-graft5285 avatar image
jordan-graft5285 asked ·

RestClient::BadRequest: 400 Bad Request

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.
aaa
1 |1000 characters needed characters left characters exceeded

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

1 Answer

· Write an Answer
Tyler Liu avatar image
Tyler Liu answered ·
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?
Share
1 |1000 characters needed characters left characters exceeded

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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