Abraham library: no redirection after signing in


#1

Hello,
I am using the abraham library.

I have done many tutorials and I don’t understand why the callback url is never called.

The file “login.php” correctly displays the twitter authentication form. Clicking on “Sign in” only redirects to https://api.twitter.com/oauth/authenticate.
However when I click on “Cancel” it redirects to the callback file.

I gave a callback url to the method “getRequestToken” and set the same url in the application settings on the twitter dev website. I have set the application access as “Read only” and checked “Allow this application to be used to Sign in with Twitter”.

This is my files:

login.php:

<?php session_start(); include_once("twitter-config.php"); include_once("lib/twitteroauth-master/twitteroauth/twitteroauth.php"); $connection = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET); $request_token = $connection->getRequestToken($OAUTH_CALLBACK); //get Request Token if( $request_token) { $token = $request_token['oauth_token']; $_SESSION['request_token'] = $token ; $_SESSION['request_token_secret'] = $request_token['oauth_token_secret']; switch ($connection->http_code) { case 200: $url = $connection->getAuthorizeURL($token); //redirect to Twitter . header('Location: ' . $url); break; default: print_r($connection->http_info); echo "
Connection with twitter Failed

Date du serveur:" . date("M d Y H:i:s", time()) . "
Date de Twitter: " . $connection->http_header['date']; break; } } else //error receiving request token { echo "Error Receiving Request Token"; } ?>


twitter-config.php:
<?php /** * @file * A single location to store configuration. */ $CONSUMER_KEY = 'XXXXXXX'; $CONSUMER_SECRET = 'XXXXXXX'; $OAUTH_CALLBACK = 'https://www.xxxxx.com/preprod/users/twitter-signin/oauth.php'; ?>


Thanks in advance for any help.

#2

Nobody have any idea?


#3

Have you checked if your app’s callback URL on dev.twitter is the same as in config.php ? I am not sure though. I was having the same problem an hour back, and found the callback URL was blank. Btw, I am using the example.com URL that Abraham uses as my app’s callback URL too.


#4

On twitter dev I have the same callback url:
http://imageshack.us/a/img202/5045/erko.png


#5

It is the same url that is used both in config file and on twitter dev .
I also tried this library: http://www.phpclasses.org/package/3-PHP-HTTP-client-to-access-Web-site-pages.html
But I still have the same problem.


#6

There is a known bug with oauth/authenticate for some user/app combinations – oauth/authorize doesn’t exhibit the same bug. This usually happens when at some point you’ve changed the permission level of your app.


#7

I changed the permissions (for the fifth time) to “Read and write” and it works well now.
Thanks


#8

Facing same issue too !
After clicking “sign in” button it do nothing, but it should be redirect in to callback page. I’m looking for solution of this issue.


#9

I too face the same problems.
I got it worked now. After creating an app from the twitter, give the permissions Read and Write and create an access token, wait for 1 min to reflect the changes and try.

After an hour of trial, its working…
Thanks