Hi peeps

"Twitter authentication failed. Please check your account name and try again."

I get the above error when trying to add my twitter account (Username and Password) to the "My accounts" section this module creates.
I'm sure that I'm using the right username and password, honest I am :)

Any ideas on what's happening here?

CommentFileSizeAuthor
#12 311460-twitter.inc_.patch416 bytesaaronbauman

Comments

rogermugs’s picture

I'm having the same issue after two days of it working just fine on my site... no explanation... i've uninstalled and re-installed the module several times and tried different usernames... same problem.

help?

binomsc’s picture

Category: support » bug
Priority: Normal » Critical

Same here, installed the module, gave permissions etc. but get the same error message :-(

josh waihi’s picture

you should check you have the right URL, twitter.com is generally fine, however I use a twitter clone that requires the url has a '/api' on the end.

Anonymous’s picture

Also know that usernames are currently case-sensitive: #349639: Twitter screen names are case sensitive
Hoping to fix that though...

liza’s picture

same problem here and am doing everything right : user, password, case-sensitive whatever. any ideas why is this happening?

liza’s picture

btw, this is happening to me from within the ACTIONS twitter config panel :( as well as the USER account. am trying to figure what's going on because even though the system took the user/pwrd globally and even though it says that it successfully posted to twitter NOTHING appears on my twitter account :(

josh waihi’s picture

liza, you may need to run cron to import twitter feeds

liza’s picture

the issue is not the importing of twitter posts (am managing that via Activity Stream); the issue is that where i have to add user name and password to make the system post to twitter it is saying that the UserName/Password combo is not being autheticated by Twitter. am wondering if this is something to do with the changes in the Twitter API.

asb’s picture

Same error here: n error occurred when posting to twitter: 401 Unauthorized.

Twitter account and credentials are working when directly logging in on twitter.com or posting tweets through TwitterFox.

If I enter a password into ./admin/settings/twitter and save the admin page, the field "Password:" remains empty (no dots or asterisks like *****), I don't know is this is supposed to not give feedback.

Looging into the database, this looks pretty messy:

mysql> select * from twitter_user;
+-----+-------------+------------+--------+
| uid | screen_name | password   | import |
+-----+-------------+------------+--------+
|   0 | exxxxx     | NULL       |      1 | 
|   4 | exxxxx     | xxxxxxxxxx |      1 | 
|   3 | exxxxx     |            |      1 | 
+-----+-------------+------------+--------+
3 rows in set (0.00 sec)

Three different uids have the same screen name, one of them has the password "NULL", one the password the userer actually entered, and one an empty password. Somehow this seem to be individual user's entries which have entered the same twitter account; some of the passwords seem to have made it into the database (the passwords are stored unencrypted!), others seem to not have been saved. Since the password is not encrypted, you can edit it directly into the database table, at least this worked for me (don't forget the backup!)

Whatever you enter on the ./admin/settings/twitter page seems to not being registered into the database, at least not into the "twitter_user" table; the "twitter_account" table has no row for passwords...

Greetings, -asb

liza’s picture

look at asb's explanation. it's the same for me.

2noame’s picture

Same problem for me. Subscribing.

aaronbauman’s picture

Title: Twitter authentication failed. Please check your account name and try again. » Users with multiple accounts, other than uid 1, cannot tweet.
Status: Active » Needs review
StatusFileSize
new416 bytes

Here's the issue, from twitter.inc in twitter_form:

      $form['account'] = array(
        '#type' => 'select',
        '#title' => t('Account'),
        '#options' => $twitter_accounts,
        '#access' => user_access(''),
        '#id' => 'twitter-account',
      )

note line 42:

        '#access' => user_access(''),

The problem is all users other than uid = 1 won't have access to the 'account' dropdown.
During nodeapi, this is where the twitter account comes from, and it's empty.
You're getting 401'ed because you're trying to authenticate without credentials.

What worked for me is removing line 42 (attached patch), making the account dropdown appear.
This allows users who have access to more than one twitter account, other than uid = 1, to tweet.

aaronbauman’s picture

Title: Users with multiple accounts, other than uid 1, cannot tweet. » Users with multiple twitter accounts, other than uid 1, cannot tweet.
steinmb’s picture

Confirming that patch #12 fixes the problem. Allowing me to choose Twitter account from the pull down menu.

joshmccormack’s picture

I had this problem, and the solution was more in using the module properly than patching or changing anything.
I had thought I needed to update my password in the module admin screen. Actually, I need to fix it from my profile. Be sure to validate that your Twitter account into in your profile is accurate.

gilf’s picture

Patch does the work for me.

elecasei’s picture

The patch work fine, thanks

eaton’s picture

Status: Needs review » Fixed

Fixed, will be committed shortly. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ggevalt’s picture

FYI, this patch does not work for me...

ggevalt’s picture

Status: Closed (fixed) » Needs work
aaronbauman’s picture

Status: Needs work » Closed (fixed)

This patch has already been committed to dev.
Please create a new issue with more info
(the patch doesn't fix the issue? the patch doesn't apply properly? etc.).

ligius’s picture

Nice, the patch did the job for me too

timmeh’s picture

still getting:
An error occurred when posting to twitter: 401 Unauthorized

what am i doing wrong?
using the latest versions of everything as of today

the patch basically says to take out line 42 correct? i did that and still getting error

janvanherp’s picture

I still get the message : An error occurred when posting to twitter: 401 Unauthorized

The patch was allready patched so there was nothing to fix. Please help. it worked fine for a few weeks and i did not update any modules.

merviemilia’s picture

The module worked fine for me until a couple of days ago it suddenly stopped working and I started to get the message:
An error occurred when posting to twitter: 401 Unauthorized

Does anyone know what is wrong?

rickyd1’s picture

I just started getting this error as well. I didn't make any changes to the twitter setup.

anyone know what is going on?

asb’s picture

Confirming, same issue here.

seesix’s picture

Confirming, same issue here.

DMacpherson’s picture

Also same issue!

piraxter’s picture

The same issue, cannot posting at twitter now !

rickyd1’s picture

I am not sure what authentication method this module is using, but I email twitter to see if my IP was blocked. They said it was not, and that

"Twitter no longer supports basic authentication in the API. If you have been using basic authentication on your websites, you will need to convert them to OAuth instead."

I am not sure how long ago this happened, but my sites went down recently. So, I am guessing it was recently.

I have seen some recent discussion about OAuth here: http://drupal.org/node/404470#comment-3402406

If you are having this problem, you may want to check it out.

Anonymous’s picture

There are numerous other issues relating to this recent change. Probably best to find an open one and post there instead.

drupalfan81’s picture

All 5 of my accounts were fine and posting to twitter. About from 1 week ago they all stopped working with this stupid error message "An error occurred when posting to twitter: 401 Unauthorized". Looks like twitter changed something to break this module. Any word on when this is going to get fixed. There is no info on the module page about this problem, but I can:'t believe its just a few of us having the problem, must be everyone no?

rickyd1’s picture

As of August 30 or something Twitter no longer accepts the basic authentication in the API. We have to use OAuth instead.

You best bet is to follow this thread for a solution http://drupal.org/node/404470#comment-3402406

I haven't had the time to get mine back up, but I have been following that thread for updates.