-
Notifications
You must be signed in to change notification settings - Fork 32
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
Yammer no longer raise Unauthorized, instead returns string "Authenticated Failure" #34
Comments
Looks like its jumping into this line: https://github.com/yammer/yam/blob/master/lib/yammer/http_adapter.rb#L86 How is this supposed to work? By catching the rest exception and merely returning a string, it makes it difficult and brittle to switch behavior on the response type. |
Would you mind posting a sample code for the kind of request in question. It would make it a lot easier to trace the root of the problem |
To reproduce:
Expected: Yammer::ApiResponse |
I am experiencing this too. Yammer::Client.new.all_users This should definitely raise an exception, it's pretty insane to return a string and have to inspect the type of the response to see if it worked or not. |
Is this gem just abandoned? This seems like a fairly important issue that still hasn't been addressed. |
@robertIngrum - This is a painful issue that I am going to take a look to fix soon. |
This seems to be affecting client = Yammer::Client.new(access_token: access_token)
# => #<Yammer::Client:0x007fe8e3257b18
# @access_token="[REDACTED]",
# @client_id="[REDACTED]",
# @client_secret="[REDACTED]",
# @connection_options={:max_redirects=>5, :verify_ssl=>true, :use_ssl=>true},
# @default_headers={"Accept"=>"application/json", "User-Agent"=>"Yammer Ruby Gem 2.5.0"},
# @http_adapter=Yammer::HttpAdapter,
# @site_url="https://www.yammer.com">
client.current_user
# => #<Yammer::ApiResponse:0x007fe8e40460f8
# @body=
# "{\"type\":\"user\",\"id\":[REDACTED],\"network_id\":[REDACTED], ...}",
# @code=200,
# @headers=
# {:status=>"200 OK", ...}>
client.current_user.code
# => 200
Yammer::Resources::User.current
Exception: NoMethodError: undefined method `success?' for "Authentication failure.":String
Did you mean? succ!
--
0: /Users/chrisbloom/.rvm/gems/ruby-2.3.1@rails/gems/rest-client-1.8.0/lib/restclient/exceptions.rb:76:in `method_missing'
1: /Users/chrisbloom/.rvm/gems/ruby-2.3.1@rails/gems/yam-2.5.0/lib/yammer/resources/user.rb:22:in `current' |
3 years after, this issue is still goin |
Its our understanding the yam gem should raise an Unauthorized exception when a request is made that is, um, unauthorized.
However, we've noticed recently that unauthorized requests are just return the string "Authenticated Failure" which is wrong because a) its not valid json b) it should be raising an exception.
Looking through the codebase, it looks like the only reference to Unauthorized is in error.rb#from_status method which I don't see being called from anywhere.
What is the proper way to handle unauthorized requests?
The text was updated successfully, but these errors were encountered: