Hi

Using Twitter Pull 7.x-2.0-alpha3 with Twitter 7.x-5.11.

I have added an authenticated account, and a non-authenticated 'pull only' account.

Twitter Pull will display tweets from the authenticated account name no problem. But if I try to use the non-authenticated account name (or a Twitter account that has not been added via Twitter module), nothing displays and these errors are reported:

  • Could not retrieve data from Twitter. Forbidden
  • Twitter Pull is using an Unauthenticated request to twitter apis. Download, enable and configure the twitter module to allow for authenticated requests
  • Twitter module is not properly configured and could not be used.

I am aware of previous issues regarding changes to Twitter API, but I'm using latest, fixed code. Twitter module is properly configured afaics; if I set it to pull tweets and run cron, it pulls tweets from both accounts. But this shouldn't be necessary for Twitter Pull?

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jason Dean created an issue. See original summary.

Jason Dean’s picture

After some experimentation, I found that reverting Twitter module to 7.x-5.8 and Twitter Pull module to 7.x-2.0-alpha2 did the trick.

Twitter Pull is now pulling tweets for any account correctly, with only a single authenticated account added to the Twitter module config.

caspervoogt’s picture

I have been experiencing the same thing, Jason. I also reverted back. I did first try to re-authenticate, in case that had anything to do with it. That didn't help. I don't why it thinks I am unauthenticated now.

bgilhome’s picture

This comes from the last block in twitter_connect() (line 44 of twitter.inc in twitter module):

    if (isset($auth['oauth_token']) && isset($auth['oauth_token_secret'])) 

If the oauth_token/secret are NULL (ie. for unauthenticated users), this returns FALSE.

So twitter_puller::twitter_get_items() logs a watchdog entry and returns FALSE (line 178 of twitter_pull.class.inc).

What should be done here? Use array_key_exists() instead of isset() in twitter_connect()?

Brian Milea’s picture

I may have an option with Twitter module 7.x-5.11 and Twitter Pull module 7.x-2.0-alpha3.

Line 177 of twitter_pull.class.inc uses the twitter_connect function to check that Twitter module has an authenticated OAuth token. $twitter = twitter_connect($twitter_account, $access_global);. However, the variables passed into the function assume that the account being pulled is an authorized account, which may not necessarily be the case.

The twitter_connect function already has the necessary logic in twitter_load_authenticated_accounts to get OAuth credentials from an authenticated user so my proposal is to pass no account into the function $twitter = twitter_connect(NULL, $access_global, TRUE);. If Twitter is properly configured, twitter_connect will return the OAuth token for the authenticated account. If no authenticated user exists, twitter_connect returns false, as it did previously, retaining the original intention of the function call.

Brian Milea’s picture

Test patch for aforementioned solution.

carloswwe’s picture

This patch will only use Authentication Keys when needed. Otherwise it call the twiiter_connect function as it previously did,

fengtan’s picture

Status: Active » Needs review
Related issues: +#2559239: Embedded tweets aren't working
FileSize
501 bytes

We are also experiencing this issue when upgrading from twitter-7.x-5.8 to twitter-7.x-5.9.
Confirmed that downgrading to twitter-7.x-5.8 resolves the problem.

Patch #6 works for me. Patch #7 does not seem to work.

It looks like twitter_connect() was changed by #2559239: Embedded tweets aren't working.
Maybe we could keep the ability to connect to authenticated twitter accounts.

hey_germano’s picture

The patch in #6 works here, with Twitter 7.x-5.10.

szeidler’s picture

Category: Support request » Bug report
Priority: Normal » Major

Patch #8 solves the issue in 7.x-2.0-alpha3 for me.

DamienMcKenna’s picture

Status: Needs review » Reviewed & tested by the community

This appears to make it work fine now.