graulund / tweetnest

NO LONGER MAINTAINED. MESSAGE ME IF YOU WANT TO MAINTAIN THIS. :) A browsable, searchable and easily customizable archive and backup for your tweets
MIT License
492 stars 93 forks source link

Unable to authorize during set-up #62

Open samwilson opened 10 years ago

samwilson commented 10 years ago

(I'm sorry I can't say more about the problem I've got, but I don't really know what's going on.)

Every time I try click the 'sign in with twitter' button (after the other fields have been filled in of course), I get the message "You must authorize Tweet Nest to use your Twitter account before continuing." But I've already done that (and Tweet Nest appears in the list of authorized applications in Twitter).

Any ideas on what I should be looking for to fix this?

Thanks!

zertrin commented 10 years ago

I have exactly the same problem, unable to set up tweetnest because it doesn't want to sign in with twitter...

There is nothing in the logs (either Apache nor in the debug comments in the HTML source) and seemingly nowhere else to look for errors...

alexmuller commented 10 years ago

What do you have in your inc/config.php file? You should have lines near the beginning that look something like this:

'consumer_key'       => 'A_RANDOM_STRING'
'consumer_secret'    => 'A_RANDOM_STRING',
'twitter_screenname' => 'YOUR_USERNAME',
'your_tw_screenname' => 'YOUR_USERNAME',
'twitter_token'      => 'YOUR_NUMERIC_ID-A_RANDOM_STRING',
'twitter_token_secr' => 'A_RANDOM_STRING',

If Tweet Nest is authorised on your Twitter account, you should be able to visit Twitter Developers and when you view your application's details you should be able to see the four random values mentioned above.

zertrin commented 10 years ago

Well there is nothing in inc/config.php because the problem occurs during the initial setup.php before inc/config.php is even written to.

I'm sure if I edited inc/config.php manually it would work, but the point here is that the problem is in setup.php or at least is related to the initial install and make it non functioning.

As told before, there is no available information in the logs about this. Moreover I didn't see any tentative from the app to contact Twitter before returning the error (checked with tcpdump on my server), I don't think the problem is on twitter's side, my dev app being properly configured on Twitter Developers.

Somehow we reach this line https://github.com/graulund/tweetnest/blob/master/setup.php#L172 without actually trying to contact Twitter...

Here some additional information:

I am trying to install the app behind a SSL VirtualHost.

PHP Version 5.4.4-14+deb7u5

Excerpt from phpinfo() : http://zerobin.zertrin.org/?061c5f9380d46696#W+M0/XrZFN3aW/ZlgIxwq0vFMoXxUN/VoQ9+xYR17nQ=

zertrin commented 10 years ago

Some more hints:

Adding <?php var_dump($_SESSION) ?> just after the <body> tag in setup.php, filling the form with all needed information and pressing the Sign in with Twitter button results in the following dump being displayed.

array(1) { ["redirect_source"]=> string(5) "setup" }

Adding <?php var_dump($_POST) ?> gives in turn the following (passwords and tokens replaced by XXXX)

array(14) { 
["consumer_key"]=> string(21) "XXXX" 
["consumer_secret"]=> string(39) "XXXX" 
["redirect_x"]=> string(2) "95" 
["redirect_y"]=> string(2) "12" 
["tz"]=> string(13) "Europe/Berlin" 
["path"]=> string(1) "/" 
["db_hostname"]=> string(9) "localhost" 
["db_username"]=> string(9) "tweetnest" 
["db_password"]=> string(16) "XXXX" 
["db_database"]=> string(9) "tweetnest" 
["db_table_prefix"]=> string(3) "tn_" 
["maintenance_http_password"]=> string(11) "XXXX" 
["maintenance_http_password_2"]=> string(11) "XXXX" 
["follow_me_button"]=> string(2) "on" 
}

What's striking me here is the absence of a variable $_POST['redirect'], and now it's clear that we don't even enter this part of the code: https://github.com/graulund/tweetnest/blob/master/setup.php#L125

This would explain quite a lot here...

zertrin commented 10 years ago

I believe this has to do with this line: https://github.com/graulund/tweetnest/blame/master/setup.php#L671

echo '<input type="image" src="inc/twitteroauth/images/lighter.png" alt="Sign in with Twitter" name="redirect" value="redirect">';

Even if the name of this input is redirect, when submitted the browser sets the variables redirect_x and redirect_y because the type of the input is image.

It's just a guess...

helgeelchenberg commented 10 years ago

Using Firefox I've had this problem, too, but in Chromium I was able to complete the setup without errors.