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

Basic authentication is not supported #278

Closed
rajagopals opened this issue Jul 2, 2012 · 7 comments
Closed

Basic authentication is not supported #278

rajagopals opened this issue Jul 2, 2012 · 7 comments

Comments

@rajagopals
Copy link

After updating to the latest tag(3.0.2), I've been getting a lot of 'Basic authentication is not supported' error when using the search API. Not sure what is the cause for this. I'm sleeping for a couple of seconds after every request, so I'm guessing API throttle limits is not causing it. Anyone has any idea?

@richo
Copy link

richo commented Jul 2, 2012

I don't believe twitter support basic auth upstream any longer.

@rajagopals
Copy link
Author

But the search api should ideally not use authenticated requests at all, correct?
Also, the error is sporadic. Initially it works all fine, but after a while of hitting the search API I run into this error and then it continuously fails.
https://dev.twitter.com/docs/auth

@richo
Copy link

richo commented Jul 2, 2012

This is true. Is the code you're using the gem in public?

If not, can you post the code you use to query twitter and any Twitter.configure blocks?

@rajagopals
Copy link
Author

begin
  Timeout::timeout(30){         
    Twitter.search(sCall, :rpp => 1, :lang => "en", :result_type => "popular", :include_entities => true).results.map{|status| store_search_status(status) }
  }
rescue Exception => ex
  puts "Error while searching for popular results in Twitter: " + sCall + " " +ex.message  
  if (retries -= 1) >= 0
    sleep(2)
    puts "\tRetrying... " + retries.to_s + " tries left"   
    retry
  end
end

Twitter.configure do |config|
config.consumer_key = ''
config.consumer_secret = ''
config.oauth_token = ''
config.oauth_token_secret = ''
end

Did you actually ask for the keys? I'm assuming no. Also, I would expect the search calls to work without the Twitter.configure block. We use the configure block for making different set of calls to the REST API which is not pasted above.

@richo
Copy link

richo commented Jul 2, 2012

Nope, didn't need the keys. Just wanted to see if you had anything that would make the twitter gem send (potentially empty) basic auth headers.

I'm out of ideas I'm afraid.

@sferik
Copy link
Owner

sferik commented Jul 3, 2012

I was under the impression that Twitter recommended all REST API requests go through api.twitter.com but it appears that search.twitter.com is still the preferred endpoint for search, according to the API documentation.

I will:

  1. Make this change
  2. Revert fbcf8f1, which removed the Twitter::Error::EnhanceYourCalm class
  3. Push version 3.0.3

@rajagopals
Copy link
Author

That will be wonderful. Thanks!

@sferik sferik closed this as completed in 8d9e942 Jul 3, 2012
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

3 participants