hayesdavis / grackle

Lightweight Ruby library for the Twitter API that goes with the flow.
228 stars 36 forks source link

Unable to decode response: A JSON text must at least contain two octets! #35

Closed mmahalwy closed 10 years ago

mmahalwy commented 10 years ago

All of a sudden keep getting this error:

Unable to decode response: A JSON text must at least contain two octets!

Don't know why?

canujohann commented 10 years ago

Same problem for 3 days.. and I found this : http://www.zdnet.com/twitter-enforces-ssl-encryption-for-apps-connecting-to-its-api-7000025138/ According to the readme file, you can set ssl to true as parameter...

hayesdavis commented 10 years ago

@mmahalwy, @canujohann is correct. Twitter recently made the change to require SSL on all connections. Grackle defaults to ssl off (which I need to change soon) but you can turn it on by passing :ssl=>true in the constructor hash.

edEssential commented 10 years ago

private def self.client Grackle::Client.new(:auth=>{ :type=>:oauth, :ssl=>true, :consumer_key=>'MY_CONSUMER_KEY', :consumer_secret=>'MY_CONSUMER_SECRET', :token=>"MY_TOKEN", :token_secret=>"MY_SECRET_TOKEN" })

end

Still giving the same message at command line... any ideas?

mmahalwy commented 10 years ago

private def self.client Grackle::Client.new(:ssl=>true, :auth=>{

:type=>:oauth, :consumer_key=>'MY_CONSUMER_KEY', :consumer_secret=>'MY_CONSUMER_SECRET', :token=>"MY_TOKEN", :token_secret=>"MY_SECRET_TOKEN" })

end

On Wed, Feb 12, 2014 at 5:57 AM, edEssential notifications@github.comwrote:

private def self.client Grackle::Client.new(:auth=>{ :type=>:oauth, :ssl=>true, :consumer_key=>'MY_CONSUMER_KEY', :consumer_secret=>'MY_CONSUMER_SECRET', :token=>"MY_TOKEN", :token_secret=>"MY_SECRET_TOKEN" })

end

Still giving the same message at command line... any ideas?

Reply to this email directly or view it on GitHubhttps://github.com/hayesdavis/grackle/issues/35#issuecomment-34858177 .

Mohamed El Mahallawy

@mmahalwy4167101981

hayesdavis commented 10 years ago

@edEssential , @mmahalwy is correct. Looks like your :ssl parameter is inside your :auth hash. It needs to be specified outside of the :auth hash. After that, all should be well.

mmahalwy commented 10 years ago

@hayesdavis should have explain afterwards. Thanks!

edEssential commented 10 years ago

@mmahalwy @hayesdavis Works perfectly. Cheers!