Hi, I have drupal 7.14 on my site, twitter 7.x-4.1 and oauth 7.x-3.0.
Everytime I try to do any action towards https://api.twitter.com (e.g. Add account, sign in, post tweets) I get the following exception on Drupal log, and nothing works :
exception 'TwitterException' with message 'Unauthorized' in /membri/iartist/portale/sites/all/libraries/twitter/twitter.lib.php:135 Stack trace: #0 /membri/iartist/portale/sites/all/libraries/twitter/twitter.lib.php(98): Twitter->request('https://api.twi...') #1 /membri/iartist/portale/sites/all/libraries/twitter/twitter.lib.php(51): Twitter->auth_request('https://api.twi...', Array) #2 /membri/iartist/portale/sites/all/modules/twitter/twitter.pages.inc(332): Twitter->get_request_token() #3 /membri/iartist/portale/includes/form.inc(1443): twitter_account_form_submit(Array, Array) #4 /membri/iartist/portale/includes/form.inc(854): form_execute_handlers('submit', Array, Array) #5 /membri/iartist/portale/includes/form.inc(374): drupal_process_form('twitter_account...', Array, Array) #6 /membri/iartist/portale/includes/form.inc(131): drupal_build_form('twitter_account...', Array) #7 /membri/iartist/portale/sites/all/modules/twitter/twitter.pages.inc(92): drupal_get_form('twitter_account...', Object(stdClass)) #8 [internal function]: twitter_user_settings(Object(stdClass)) #9 /membri/iartist/portale/includes/menu.inc(516): call_user_func_array('twitter_user_se...', Array) #10 /membri/iartist/portale/index.php(21): menu_execute_active_handler() #11 {main}
Comment | File | Size | Author |
---|---|---|---|
#14 | twitter.png | 50.64 KB | npralhad |
#13 | twitter.png | 50.64 KB | npralhad |
Comments
Comment #1
cruze72 CreditAttribution: cruze72 commentedSame here ...
Comment #2
saru1683 CreditAttribution: saru1683 commentedI have installed Drupal 7.14 with modules Twitter 7.x-4.1+5-dev and Oauth 7.x-3.0+18-dev.
during add account I got error message like
"Could not obtain a valid token from the Twitter API. Please review the configuration".
I got same error log.
Comment #3
juampynr CreditAttribution: juampynr commentedDid you configured your OAuth keys at the Twitter settings? Please have a look at the Twitter installation page, specially the parts that mention OAuth http://drupal.org/node/1346824.
Comment #4
deimos83 CreditAttribution: deimos83 commentedI followed everything, but nope..
In addition I have to report that when I click "Add account" there is no field for the account name to add, instead if I take an older version of this module( eg. 7.x-3.x) I am able to add an account when Oauth is not installed but then nothing too..
Comment #5
somms CreditAttribution: somms commentedI've had the same problem, but I've solved it.
The problem was that I didn't filled the "Callback URL" parameter in the Twitter application settings (in dev.twitter.com)
Comment #6
deimos83 CreditAttribution: deimos83 commentedI checked and double checked it but my callback url on twitter is the same of that in the twitter module...
Comment #7
timoa CreditAttribution: timoa commentedAfter many tests, I just add the callback URL found in settings of Twitter Drupal module to the Twitter App settings (tab "Settings", field "Callback URL" and it work :)
Comment #8
marko42 CreditAttribution: marko42 commented#7 worked for me. Thanks timoa!
Comment #9
ianmen CreditAttribution: ianmen commentedThe fix for me was to add the security option to place posts on Twitter in the twitter app settings.
Comment #10
juampynr CreditAttribution: juampynr commentedPlease everybody else review that the permissions of your Twitter app at dev.twitter.com are Read and Write. Note that changing this from Read only to Read and Write means that you need to re-authenticate your twitter accounts so they gain the new privileges.
Comment #11
jebuske CreditAttribution: jebuske commentedI've put in my consumer key and consumer secret correctly and have put the permissions to read and write. No, how do I re-authenticate my twitter account? I'm still getting the "Could not obtain a valid token from the Twitter API. Please review the configuration". error when I want to add an account
Thank you!
Comment #12
sujith7c CreditAttribution: sujith7c commentedYes. This works for me
Comment #13
npralhad CreditAttribution: npralhad commentedHi jebuske
I hope you have confirmed following
At last please have a look at the attached screen as you must have to authenticate your account.
These steps have helped me and hope will help you as well.
Comment #14
npralhad CreditAttribution: npralhad commentedHi jebuske
I hope you have confirmed following
At last please have a look at the attached screen as you must have to authenticate your account.
These steps have helped me and hope will help you as well.
Let me know in case still you have the problems :)
Comment #15
kikoalonsob CreditAttribution: kikoalonsob commentedI have the same problem.
If i click "Go to twitter to add an authenticated account" in admin/config/services/twitter everything seems ok, i return to my site and see my account details.
The problem is when I try to login with a twitter account, it says "Invalid Twitter OAuth request" and in dblog it says:
exception 'TwitterException' with message 'Unauthorized' in /var/www/dev.mysite.com/htdocs/sites/all/modules/twitter/twitter.lib.php:135 Stack trace: #0 /var/www/dev.mysite.com/htdocs/sites/all/modules/twitter/twitter.lib.php(98): Twitter->request('https://api.twi...') #1 /var/www/dev.mysite.com/htdocs/sites/all/modules/twitter/twitter.lib.php(79): Twitter->auth_request('https://api.twi...') #2 /var/www/dev.mysite.com/htdocs/sites/all/modules/twitter/twitter.pages.inc(421): Twitter->get_access_token() #3 /var/www/dev.mysite.com/htdocs/includes/form.inc(1464): twitter_oauth_callback_form_validate(Array, Array) #4 /var/www/dev.mysite.com/htdocs/includes/form.inc(1404): form_execute_handlers('validate', Array, Array) #5 /var/www/dev.mysite.com/htdocs/includes/form.inc(1134): _form_validate(Array, Array, 'twitter_oauth_c...') #6 /var/www/dev.mysite.com/htdocs/includes/form.inc(846): drupal_validate_form('twitter_oauth_c...', Array, Array) #7 /var/www/dev.mysite.com/htdocs/includes/form.inc(704): drupal_process_form('twitter_oauth_c...', Array, Array) #8 /var/www/dev.mysite.com/htdocs/sites/all/modules/twitter/twitter.pages.inc(372): drupal_form_submit('twitter_oauth_c...', Array) #9 [internal function]: twitter_oauth_callback(Array, Array) #10 /var/www/dev.mysite.com/htdocs/includes/form.inc(798): call_user_func_array('twitter_oauth_c...', Array) #11 /var/www/dev.mysite.com/htdocs/includes/form.inc(339): drupal_retrieve_form('twitter_oauth_c...', Array) #12 /var/www/dev.mysite.com/htdocs/includes/form.inc(131): drupal_build_form('twitter_oauth_c...', Array) #13 [internal function]: drupal_get_form('twitter_oauth_c...') #14 /var/www/dev.mysite.com/htdocs/includes/menu.inc(517): call_user_func_array('drupal_get_form', Array) #15 /var/www/dev.mysite.com/htdocs/index.php(21): menu_execute_active_handler() #16 {main}
Comment #16
npralhad CreditAttribution: npralhad commentedIts a problem with your TWITTER secret key.
At last please have a look at the attached screen as you must have to authenticate your account.
These steps have helped me and hope will help you as well.
Comment #17
gantenx CreditAttribution: gantenx commentedI experienced this issue too. Consumer key and consumer secret has been set up correctly, but still no luck. I found this article: https://dev.twitter.com/discussions/1043. This issue probably comes from invalid timestamp.
Comment #19
csedax90 CreditAttribution: csedax90 commentedsame problem... i've tried with the latest solution of this post(https://dev.twitter.com/discussions/1043) but nothing appens... some ideas?
Comment #20
gantenx CreditAttribution: gantenx commentedI don't know if this work on yours, but try to synchronize your server time with NTP server. My issue solved after synchronizing server time. The issue seemed come from invalid timestamp.
Comment #21
phanophite CreditAttribution: phanophite commentedThis worked for me as well even though my site is a Drupal 6 site.
Comment #22
OMD CreditAttribution: OMD commentedexperiencing the same issue with the same error log message
Comment #23
deardagny CreditAttribution: deardagny commentedJust clicking the "Go to Twitter to add an Authenticated Account" button after updating the access permissions on my Twitter application solved this issue for me.
Comment #24
truyenle CreditAttribution: truyenle commentedsame issue none of the above work for me.
Comment #25
glass.dimly CreditAttribution: glass.dimly commentedI was getting this error about June of 2013 on my blog, possibly timed to a Twitter API change. I haven't really had time to work on it until now because I had forked the Twitter module and figured it was my fault. Still might be. But now I'm running on the latest stable.
I had two accounts activated. One used to be my "sitewide" twitter account, but this is a setting I can no longer find on the twitter account settings: /admin/settings/twitter
I re-authenticated my new twitter account, the account on which the app is hosted, but the one which was not previously my "sitewide" twitter account.
I was only able to resolve this issue when I re-authenticated the account that was previously the "sitewide" twitter account. Or perhaps all the accounts need to be authenticated?
After that I ran cron and started getting my tweets for my new, not-sitewide twitter account.
Suggested work-around: authenticate all Twitter accounts and remove non-authenticated ones.
Suggested fix: allow users to specify which Twitter account is being used to access the Twitter API.
I realize this is a 7x bug, but I'm running the latest stable 6x version: 6.x-5.1 with oauth 6.x-3.0-beta5. I think this information may be useful to subscribers on this thread.
Comment #26
cthshabel CreditAttribution: cthshabel commentedI am receiving this error when using Rules to post to Twitter. Since each individual user needs to post to their own account, we use rules to post, instead of the post to twitter via the content type configuration.
Everything works fine when the [node-title] [node-url] is under the 140 character limit; however, it seems Twitter doesn't shorten this correctly when over the 140 limit. The title should be shortened to fix this, keeping the url. This is similar to this issue: https://www.drupal.org/node/797592 ... This patch is deprecated for newer versions, and custom tokens can be used easily to shorten the title.
The Post to Twitter submodule did propose a fix for this here: https://www.drupal.org/node/369224 but it doesn't get triggered when using the Rules (Twitter Actions) sub module. But the concept is the same. Check the title length and shorten if necessary.
Figured I would leave the notes here since I did receive this same error, and it was unrelated to apps.twitter.com permissions (Read & Write) and OAuth permissions on both sides. I imagine those items will typically be the solution for this issue.
Comment #27
rclemings CreditAttribution: rclemings as a volunteer commentedOne more thing to check ...
I got this error when fetching tweets from non-authenticated users:
(from /admin/reports/dblog, type "twitter)
The problem, I eventually figured out, was that one or more of the users had their tweets set to private. Unchecking their "tweets" box at /admin/config/services/twitter was the fix.
Comment #28
KhaledBlah CreditAttribution: KhaledBlah commentedI, too, had this issue but instead my error message was 'Authorization Required' (see below) and once I filled the callback URL on the Twitter app settings page it worked. The callback URL is optional on twitter so maybe a warning message that it is required for this module to work would be a good idea.
exception 'TwitterException' with message 'Authorization Required' in <root>/sites/all/modules/twitter/twitter.lib.php:175 Stack trace: #0 <root>/sites/all/modules/twitter/twitter.lib.php(123): Twitter->request('https://api.twi...') #1 <root>/sites/all/modules/twitter/twitter.lib.php(55): Twitter->auth_request('https://api.twi...', Array) #2 <root>/sites/all/modules/twitter/twitter.pages.inc(405): Twitter->get_request_token(Array) #3 <root>/includes/form.inc(1519): twitter_auth_account_form_submit(Array, Array) #4 <root>/includes/form.inc(903): form_execute_handlers('submit', Array, Array) #5 <root>/includes/form.inc(385): drupal_process_form('twitter_auth_ac...', Array, Array) #6 <root>/includes/form.inc(130): drupal_build_form('twitter_auth_ac...', Array) #7 <root>/sites/all/modules/twitter/twitter.pages.inc(176): drupal_get_form('twitter_auth_ac...') #8 [internal function]: twitter_user_settings() #9 <root>/includes/menu.inc(527): call_user_func_array('twitter_user_se...', Array) #10 <root>/index.php(21): menu_execute_active_handler() #11 {main}
Comment #29
KhaledBlah CreditAttribution: KhaledBlah commentedNever mind my last comment. Just saw that I should have been more attentative with the installation instructions ;-)