abrom / rocketchat-ruby

Ruby wrapper for RocketChat v1 REST API
MIT License
33 stars 24 forks source link

302 response #26

Closed acflint closed 6 years ago

acflint commented 6 years ago

Hello! I'm running into an issue, which may just be my mistake. I'm running RC version 0.65.0.

Any request to the server returns a 302 response code. For example, I create a server with ROCKET_SERVER = RocketChat::Server.new(ENV["ROCKET_URL"], debug: $stderr) and when I try to login, or even get server info I get a 302 response. Such as ROCKET_SERVER.info returns RocketChat::HTTPError: Invalid http response code: 302. Do you have any suggestions to resolve that? Thanks!

abrom commented 6 years ago

It sounds like you have some sort of configuration issue.. What do you get if you request the info directly??

ie:

curl <your RC server schema & host>/api/v1/info
acflint commented 6 years ago

Hey @abrom, thanks for the super quick reply. I get {"info":{"version":"0.65.0"},"success":true} when I hit the API directly. The login, and all other calls work for me fine in AJAX or using Postman.

abrom commented 6 years ago

And how about:

require 'rocketchat'

rocket_server = RocketChat::Server.new('http://your.server.address/')
puts rocket_server.info
acflint commented 6 years ago

RocketChat::HTTPError: Invalid http response code: 302

acflint commented 6 years ago

Oh! @abrom I think I found it. My server requires HTTPS. It seems to work with that. Sorry for bothering you!

abrom commented 6 years ago

That'll do it ;)