Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization Errors #23

Open
joelmahoney opened this issue Sep 3, 2011 · 5 comments
Open

Authorization Errors #23

joelmahoney opened this issue Sep 3, 2011 · 5 comments

Comments

@joelmahoney
Copy link

I'm trying to log in with a username, password and URL that have been verified by Rapattoni, but I continue to get:

RETS4R::Client::LoginError: Unauthorized.

Any suggestions?

@digitalaun
Copy link
Contributor

If I'm not mistaken, some Rapattoni systems also require that a specific user agent and/or a user agent password be set. If so, not supplying those would raise an unauthorized login error. If you need to set a user agent, it can be done using RETS4R::Client#user_agent= and if you do need to set a user agent password, check out the documentation for RETS4R::Client#set_pre_request_block.

If your MLS doesn't require those, nor limits to specific IP addresses, you might want to check out the master branch as there has work on the auth code recently that might address your problem. I know that I've accessed a Rapattoni system several years ago, but there's a lot that could have changed since then.

@joelmahoney
Copy link
Author

Thanks - the missing user_agent was the problem. Rapattoni doesn't require a user_agent_password, however, I'm now getting an error at set_pre_request_block. Here's the full backtrace - any ideas?

ruby-1.9.2-p290 :005 > retsclient = RETS4R::Client.new(rets_url)
=> #<RETS4R::Client:0x00000104951690 @request_struct=#<RETS4R::Client::Requester:0x00000104951668 @nc=0, @headers={"User-Agent"=>"rets4r/1.1.18", "Accept"=>"/", "RETS-Version"=>"RETS/1.7"}, @pre_request_block=nil>, @Format="COMPACT", @urls={"Login"=>#<URI::HTTP:0x00000104951230 URL:http://rets172lax.raprets.com:6103/SantaFe/SFE/login.aspx>}, @request_method="GET", @response_parser=#RETS4R::Client::ResponseParser:0x000001049510a0, @mimemap={"image/jpeg"=>"jpg", "image/gif"=>"gif"}>
ruby-1.9.2-p290 :006 > retsclient.user_agent = 'mahoney/1.0'
=> "mahoney/1.0"
ruby-1.9.2-p290 :007 > login_result = retsclient.login(username, password)
RETS4R::Client::HTTPError: 400 Bad Request.: The request could not be understood by the server due to malformed syntax.
from /Users/lat45n/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-1.1.18/lib/rets4r/client/requester.rb:102:in block in request' from /Users/lat45n/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:627:instart'
from /Users/lat45n/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-1.1.18/lib/rets4r/client/requester.rb:77:in request' from /Users/lat45n/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-1.1.18/lib/rets4r/client.rb:461:inrequest'
from /Users/lat45n/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-1.1.18/lib/rets4r/client.rb:205:in login' from (irb):7 from /Users/lat45n/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands/console.rb:44:instart'
from /Users/lat45n/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands/console.rb:8:in start' from /Users/lat45n/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands.rb:23:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

@digitalaun
Copy link
Contributor

Glad that solved the initial issue. My first thought is that it might be a problem with running under ruby 1.9, as I don't believe the fixes for 1.9 are in the 1.1.18 gem. Could you give it a try either under ruby 1.8 or from a clone of master?

@joelmahoney
Copy link
Author

Even after I switch to 1.8.7-p352, I still get:

RETS4R::Client::HTTPError: 400 Bad Request.: The request could not be understood by the server due to malformed syntax.
from /Users/lat45n/.rvm/gems/ruby-1.8.7-p352/gems/rets4r-1.1.18/lib/rets4r/client/requester.rb:102:in request' from /Users/lat45n/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/net/http.rb:543:instart'
from /Users/lat45n/.rvm/gems/ruby-1.8.7-p352/gems/rets4r-1.1.18/lib/rets4r/client/requester.rb:77:in request' from /Users/lat45n/.rvm/gems/ruby-1.8.7-p352/gems/rets4r-1.1.18/lib/rets4r/client.rb:461:inrequest'
from /Users/lat45n/.rvm/gems/ruby-1.8.7-p352/gems/rets4r-1.1.18/lib/rets4r/client.rb:205:in `login'
from (irb):8

Any further ideas?

@digitalaun
Copy link
Contributor

Not sure what would be causing that. Can you set logger with its level set to debug? It'd be helpful to see what exactly it's sending to the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants