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

401 "Unauthorised" on all requests. #3

Closed
shaneshort opened this issue Oct 31, 2011 · 7 comments
Closed

401 "Unauthorised" on all requests. #3

shaneshort opened this issue Oct 31, 2011 · 7 comments

Comments

@shaneshort
Copy link

Hi Guys,
Every time I try and access the assitly API through the gem, it throws me out with a 401 unauthorised.
I wrote a small script to test with, to ensure OAuth itself was working. I assume there's something perhaps not working 100% when it gets through to faraday, but I can't be sure.

Test Code:

http://pastie.org/private/yhbgdqfgpgxutbmjwm2pqw

Output:

$ ../script/runner  -f assitly_gem_test.rb 

ERROR: HTTP 401 thrown
--
#<Net::HTTPOK 200 OK readbody=true>

Installed gems:

# gem list --local

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.9, 2.3.14, 2.3.8)
actionpack (3.0.9, 2.3.14, 2.3.8)
activemodel (3.0.9)
activerecord (3.0.9, 2.3.14, 2.3.8)
activeresource (3.0.9, 2.3.14, 2.3.8)
activesupport (3.0.9, 2.3.14, 2.3.8)
addressable (2.2.6)
adzap-ar_mailer (2.1.5)
archive-tar-minitar (0.5.2)
arel (2.0.10)
assistly (0.2.6, 0.2.4)
builder (2.1.2)
bundler (1.0.17)
calendar_date_select (1.15)
daemon_controller (0.2.6)
erubis (2.6.6)
faraday (0.7.5, 0.6.1)
faraday_middleware (0.7.0, 0.6.5)
fastercsv (1.5.3)
fastthread (1.0.7)
file-tail (1.0.4)
gemcutter (0.4.1)
hashie (1.1.0, 1.0.0)
hoe (2.5.0)
hpricot (0.8.2)
i18n (0.5.0, 0.4.1)
json_pure (1.5.3, 1.2.2)
mail (2.2.19)
mime-types (1.16)
mini_magick (1.2.5)
multi_json (1.0.3, 0.0.5)
multi_xml (0.4.1, 0.2.2)
multipart-post (1.1.3)
mysql (2.8.1)
nokogiri (1.4.1, 1.3.3)
oauth (0.4.5)
passenger (3.0.8, 2.2.5)
pg (0.8.0)
polyglot (0.3.2)
pony (1.3)
rack (1.3.2, 1.2.3, 1.1.2)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.9, 2.3.14, 2.3.8)
railties (3.0.9)
rake (0.9.2, 0.8.7)
rash (0.3.0)
rcov (0.9.8)
rdoc (3.9.1)
redbox (1.0.4)
rest-client (1.4.0)
rt-client (0.2.2)
ruby-ldap (0.9.11)
ruby-net-ldap (0.0.4)
rubyforge (2.0.4, 2.0.3)
simple_oauth (0.1.5)
snmp (1.0.3)
sqlite3-ruby (1.2.5)
thor (0.14.6)
tmail (1.2.7.1)
treetop (1.4.10)
tzinfo (0.3.29)
validates_timeliness (2.3.1)
xeroizer (0.3.5)
xml-simple (1.0.12)
yajl-ruby (1.0.0)
@chriswarren
Copy link
Owner

Ran your script using the credentials I use with the gem in production and I'm able to successfully retrieve a case, but I get an error in the second part of the script:

/Users/cdw/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError)

I haven't had a chance to investigate any further yet.

@shaneshort
Copy link
Author

interesting, is is possible our version of faraday is different to yours in some way?

@chriswarren
Copy link
Owner

It looks like we're running the same:

faraday (0.7.5)
faraday_middleware (0.7.0)

@chriswarren
Copy link
Owner

If you make a brand new directory and use RVM to have a clean slate with just Assistly, OAuth, and JSON, are you able to connect?

@shaneshort
Copy link
Author

I created a new gemset and went to install the assistly gem:

:~# gem install assistly
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: assistly requires hashie (~> 1.0.0); rash requires hashie (~> 1.1.0)

Looks like rash has been recently updated, so installed the older version:

:~# gem install rash --version 0.3.0
Fetching: hashie-1.0.0.gem (100%)
Fetching: rash-0.3.0.gem (100%)
Successfully installed hashie-1.0.0
Successfully installed rash-0.3.0
2 gems installed

Then installed the assistly, json and oauth gems and re-ran my test (http://pastie.org/private/r6bfn2cmg4r8i0pdetllq -- updated as I was being lazy with some requires due to the fact I was including from rails):

:~# rvm gemset list ; ruby --version ; ruby /srv/conventia/wiab/rails/tmp/assitly_gem_test.rb ; gem list --local
gemsets for ree-1.8.7-2011.03 (found in /usr/local/rvm/gems/ree-1.8.7-2011.03)
=> assistly-test
   global

ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2011.03
ERROR: HTTP 401 thrown
--
#<Net::HTTPOK 200 OK readbody=true>

*** LOCAL GEMS ***

addressable (2.2.6)
assistly (0.2.6)
bundler (1.0.21)
faraday (0.7.5)
faraday_middleware (0.7.0)
hashie (1.0.0)
i18n (0.6.0)
json (1.6.1)
mail (2.3.0)
mime-types (1.17.2)
multi_json (1.0.3)
multi_xml (0.4.1)
multipart-post (1.1.3)
oauth (0.4.5)
polyglot (0.3.3)
pony (1.3)
rack (1.3.5)
rake (0.8.7)
rash (0.3.0)
simple_oauth (0.1.5)
treetop (1.4.10)

@shaneshort
Copy link
Author

do you need any more information from me?

@chriswarren
Copy link
Owner

Did you figure this out? I've seen this error come up when something in the request is invalid/unsupported by the Assistly/Desk API. Nothing's jumping out at me in your request, but it'd be worth checking in to.

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