Update - Login with Facebook and Twitter
Wall Script
Follow Me:
Monday, September 19, 2011

Update - Login with Facebook and Twitter

Long days back we had posted an article Login with Facebook and Twitter. It’s now most visited article on 9lessons. I received many comments that asked to me to update the Facebook login system to get user email. So that I had modified existing script to getting Facebook email address automatically and storing Twitter OAuth tokens, take a quick look at new live demo.

Facebook Twitter Login


Download Script     Live Demo

Was this article helpful?
Thanks! Your feedback helps us to improve 9lessons.info


63 comments:

  1. Will be cool if this tutorial include also yahoo, google+ , gmail login or some of them. If this is in plan for future please let us know. By the way thank you very much for this and for all what you done !

    ReplyDelete
  2. Nice demo srinivas ! Thanks for sharing...

    ReplyDelete
  3. i have been waiting for ur wall script version 4 . its being a month u not releasing it . and u promised it 1 months back that next week you gonna release it . at least don,t make fake promises . i really follow your blog to learn stuffs . but m sorry t say its disappointing.

    ReplyDelete
  4. @Anonymous - How about saying thank you instead of complaining.

    ReplyDelete
  5. i love this option. but i need this same option with asp or aspx. if you possible plz help me. i am a regular visitor.

    ReplyDelete
  6. Thanks for your sharing. I am very interesting this topic. I was wait twenty four hour but I can't download that script. Please help me!

    ReplyDelete
  7. It looks like a fantastic script, but I also am not able to download it.

    ReplyDelete
  8. What Can I say, Thank you. You've doing just fine

    ReplyDelete
  9. When I try to login with facebook, the following error occurs:

    Warning: Missing argument 5 for User::checkUser(), called in /var/www/web1353/html/auth/login-facebook.php on line 35 and defined in /var/www/web1353/html/auth/config/functions.php on line 7

    Warning: Missing argument 6 for User::checkUser(), called in /var/www/web1353/html/auth/login-facebook.php on line 35 and defined in /var/www/web1353/html/auth/config/functions.php on line 7

    ReplyDelete
  10. Hi! This is a great script. It has been very useful. I just have a question (maybe it's a silly one) What is the purpose of saving in the database the token and secret token?

    ReplyDelete
  11. @Dan

    Using token you can access twitter data anytime.

    ReplyDelete
  12. Ok, ok. I should save the access token and access token secret right?
    And another question. Is there a way, to get the oauth_verifier/denied from Twitter via POST?
    (I have change the getRequestToken() and getAccessToken() method to POST, but the oauth_verifier is still coming via GET)

    ReplyDelete
  13. Hi Bro Srinivas,
    I got error...

    Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in C:\wamp\www\Facebook_Twitter_Login 3\Facebook_Twitter_Login\facebook\base_facebook.php:19 Stack trace: #0 C:\wamp\www\Facebook_Twitter_Login 3\Facebook_Twitter_Login\facebook\facebook.php(18): require_once() #1 C:\wamp\www\Facebook_Twitter_Login 3\Facebook_Twitter_Login\login-facebook.php(3): require('C:\wamp\www\Fac...') #2 {main} thrown in C:\wamp\www\Facebook_Twitter_Login 3\Facebook_Twitter_Login\facebook\base_facebook.php on line 19

    ReplyDelete
  14. I don't like the idea of leaving the website and then redirecting back.

    What should I modify in order for this script to login using a secure popup window like in this website: fitnessmagazine dot com. When I login there, a secure popup window from Facebook, Google, Yahoo appears then after login that popup closes and the website page refreshes and I'm logged in.

    ReplyDelete
  15. what is facebook api ? how can i manage it or then use it ? will u please give a app id and secret key to run that openid script...thanks

    ReplyDelete
  16. I implemented new example and have one question: why on your live demo when clicking Facebook button you get standard fb app premision window, while in my example it is just a login window? Are there different permisions/login types ?

    ReplyDelete
  17. how about requesting for permission with facebook to get the access_token?

    ReplyDelete
  18. Thanks a lot! Great!!!

    ReplyDelete
  19. Demo is very good but
    logout not work properly....
    when i click on logout on our site then also not logout....from facebook...

    ReplyDelete
  20. Sir, I having a problem with facebook log out, if i logged out in your application, I'm still log in in my facebook account.

    ReplyDelete
  21. sir i am also facing same problem while log out

    ReplyDelete
  22. I don't understand why login-facebook.php file uses twitter vars:$twitter_otoken & $twitter_otoken_secret

    In other words, why User Class depends on these two vars. Facebook has nothing to do with that, hasn't it?

    $user->checkUser($uid, 'facebook', $username, $email, $twitter_otoken, $twitter_otoken_secret);

    So, i'm getting this error:
    Notice: Undefined variable: twitter_otoken in /home/guillermo/www/iloby/trunk/public/social/login-facebook.php on line 35

    ReplyDelete
  23. Well, i solved it declaring them null vars for facebook connect:
    $twitter_otoken = $twitter_otoken_secret = null;

    ReplyDelete
  24. Any clue about why i'm getting "Could not authenticate with OAuth" error? This happens in getTwitterData.php, in response to $twitteroauth->get('account/verify_credentials')

    ReplyDelete
  25. Dismiss my last comment. I wasn't setting my app key correctly.

    ReplyDelete
  26. Wooow! i've been doing research for weeks about this stuff, this is by far the best tut. ever found. But i have an issue, i finally get to connect to the DB and my FB APP, but it return some error msg -> "Column count doesn't match value count at row 1"

    Right after i click the login button!

    ReplyDelete
  27. do we need a callback url in twitter if so what would it be? and how about facebook? great job by the way

    ReplyDelete
  28. twitter don't return the email address?

    ReplyDelete
  29. I have two sites that uses this script and the same getLoginUrl array from this script. Obviously different tokens and everything but both have the "email" on their scope.

    One works ok but the other never shows the email request on facebook's request authorization dialog and therefore doesn't have access to email address data.

    Is there something, a setting or maybe a checkbox that we need to change or complete on facebook's app settings in order to allow asking for user's email?

    ReplyDelete
  30. hi,
    I just wanna know how i can get the ecript? i sunscribed but still didn't manage to dl the script :( mayve someone can point me to the right direction?

    ReplyDelete
  31. same problem about subscription...????
    help..!!!!

    ReplyDelete
  32. Subscription functionality is not working....
    First fix this one after then give download script you.... ;)

    ReplyDelete
  33. I can't fix it ! Please !
    Column count doesn't match value count at row 1

    ReplyDelete
  34. My table users :
    CREATE TABLE users
    (
    id INT PRIMARY KEY AUTO_INCREMENT,
    email VARCHAR(70),
    oauth_uid int(11),
    oauth_provider VARCHAR(100),
    username VARCHAR(100),
    twitter_oauth_token VARCHAR(200),
    twitter_oauth_token_secret VARCHAR(200)
    );

    ReplyDelete
  35. Leonardo CardosoJune 17, 2012 at 9:50 PM

    how to catch the user's facebook id?

    ReplyDelete
  36. Beware: Twitter does not return email address. This is a pretty useless twitter API. From my point of voew it is pretty useless.

    Can someone tell me how do you strip the #_=_ from the home page when you log in with facebook?

    ReplyDelete
  37. Beware: Twitter does not return email address. This is a pretty useless twitter API. From my point of voew it is pretty useless.

    Can someone tell me how do you strip the #_=_ from the home page when you log in with facebook?

    ReplyDelete
  38. If you are getting the "Column count doesn't match value count at row 1" error, update your Functions.php with the following code. The error is in the insert command.

    $query = mysql_query("INSERT INTO `users` (oauth_provider, oauth_uid, username,email,twitter_oauth_token,twitter_oauth_token_secret) VALUES ('$oauth_provider', $uid, '$username','$email','','')") or die(mysql_error());

    ReplyDelete
  39. An error occurred. Please try later

    API Error Code: 191
    API Error Description: The specified URL is not owned by the application
    Error Message: Invalid redirect_uri: Given URL is not permitted by the application configuration.

    this error shown on face book please help me ...

    i have a free domain ("www.jagoindian.net84.net") is this work on this ...
    please help me sir...

    ReplyDelete
  40. thank for you posting i am using this scripting in my project

    can we get the profile picture using this ?

    ReplyDelete
  41. i get the following error

    The page isn't redirecting properly







    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.





    This problem can sometimes be caused by disabling or refusing to accept
    cookies.

    ReplyDelete
  42. i got following error while loading this script
    twitter-login : Something wrong happened.
    facebook login :Column count doesn't match value count at row 1

    please help to fix.thanks.

    ReplyDelete
  43. I have tried this via my mobile web it keeps giving me the error

    Given URL is not allowed by the Application configuration.: One or more
    of the given URLs is not allowed by the App's settings. It must match the
    Website URL or Canvas URL, or the domain must be a subdomain of one
    of the App's domains.'

    It works well on ddesktop but not on mobile. And i used thesame URL for Website and Mobile Web during the cofiguration on facebook

    ReplyDelete
  44. Same like Daniel on above, the page isn't redirecting properly.
    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    please help

    ReplyDelete
  45. for the twitter api 1.1 onlu change public $host = "https://api.twitter.com/1.1/"; in twitteroauth.php ??

    ReplyDelete
  46. I am integrating facebook login & getting error This webpage has a redirect loop.I don't nderstand this problem. Can anybody having any idea?

    ReplyDelete
  47. Where Can I get id, email, oauth_uid, oauth_provider ,username, twitter_oauth_token, twitter_oauth_token_secret??
    Please Answer !!!

    ReplyDelete
  48. Channel url error is coming How should i resolve it Plz help me

    ReplyDelete
  49. Warning: Missing argument 5 for User::checkUser(), called in /home/content/66/11978366/html/login-facebook.php on line 30 and defined in /home/content/66/11978366/html/config/functions.php on line 7


    i m getting this error . when i m adding fb login script in my website..
    please hep me out

    ReplyDelete
  50. I am getting the "Column count doesn't match value count at row 1" error

    ReplyDelete
  51. Twitter login does not redirect.. gets stuck in ... getTwitterData.php?oauth_token=.....

    ReplyDelete
  52. Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

    ReplyDelete
  53. What is this DS_STORE file and what its use in the facebook login download script?
    Thanks in advance.

    ReplyDelete
  54. Facebook API v2.6
    problem -> login-facebook.php

    $username = $user_profile['name']; // OK
    $uid = $user_profile['id']; // OK
    $email = $user_profile['email']; // FAIL

    The variable $email and does not return at all. Any idea to solve the problem?

    ReplyDelete

Make in India