Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

client.authorized? returns false for valid clients #38

Closed
arbesulo opened this Issue · 5 comments

4 participants

@arbesulo

Hi,

I'm having problems with the client.authorized? method. I have realized that returns false even when the client is a valid one. Here are the last steps of my client set up:

client = TwitterOAuth::Client.new({:consumer_key => config.consumer_key, :consumer_secret => config.consumer_secret, :token => access_token.token, :secret => access_token.secret }

client.authorized?
=> false

client.update("test!")
{"id"=>256373778823671808, .... }

This was working until recently... did I miss some update?
Thanks in advance!

@GabGab

Hi, I actually have the exact same problem and have been struggling with this all afternoon. Today all of a sudden we can no longer use our twitter connect button because of a 401 Unauthorized response gotten from this line :

  @access_token = @client.authorize(twitter_session[:temporary_token], twitter_session[:temporary_secret], {
    :oauth_verifier => params[:oauth_verifier]
  })

We have correctly configured a callback url in our twitter App (the connect used to work perfectly until today).

Just to make things clear, our workflow is the following :

First we do :

@client = TwitterOAuth::Client.new(
      :consumer_key => SocialNetworkConfig.twitter.consumer_key,
      :consumer_secret => SocialNetworkConfig.twitter.consumer_secret
  )
 request_token = @client.authentication_request_token(:oauth_callback => create_twitter_session_url(:protocol => "http#{'s' if Rails.env.production?}"))

 twitter_session[:temporary_token] = request_token.token
  twitter_session[:temporary_secret] = request_token.secret

  redirect_to request_token.authorize_url

Then once the app has been authorized via twitter :

@client = TwitterOAuth::Client.new({
    :consumer_key => SocialNetworkConfig.twitter.consumer_key,
    :consumer_secret => SocialNetworkConfig.twitter.consumer_secret
  })

  @access_token = @client.authorize(twitter_session[:temporary_token], twitter_session[:temporary_secret], {
    :oauth_verifier => params[:oauth_verifier]
  })

 @client.authorized?

The last line returns false when we have perfectly valid users that are known to have accepted permissions. Through our debugging we have determined that the issue does not come from our code, maybe Twitter changed the way it's communicating this type of info ?

Thanks again for any help you can provide ! Take care

@paulvictor

We've also had this problem since morning. Changing the path in TwitterOauth::Client.authorized? "/1/account/verify_credentials.json" fixed it.

@GabGab

I see, to change this you had to unpack, modify and then rebuild the gem ?

@moomerman
Owner

Just pushed v0.4.4 with this fix in. Thanks!

@moomerman moomerman closed this
@GabGab

It works perfectly now, thanks for your fast reaction :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.