why do I get the following text right under Facebook Login image:
"Be the first of your friends to use [my website]"
How I do get rid of it? All I am using is $this->Facebook->login();
Where is it picking up the text from?
Great plugin, by the way.
I have trouble when following your tutorial, I get this error:
Notice (8): Undefined index: appId [APP\plugins\facebook\vendors\facebook\src\base_facebook.php, line 213]
Notice (8): Undefined index: secret [APP\plugins\facebook\vendors\facebook\src\base_facebook.php, line 214]
Notice (8): Undefined property: Facebook::$table [CORE\cake\libs\model\model.php, line 666]
I am able to login, the error first occured when I tried to implement Auth.
i'm trying to follow the instructions bu i'm coming across with errors.
my application already has login and AppController when i input var $helpers = array('Facebook.Facebook'); into appcontroller there is a error.
here is the error which is displayed :
Warning (4096): Argument 1 passed to Helper::__construct() must be an instance of View, none given, called in /Users/emrahgul/Sites/evento/app/Plugin/Facebook/views/helpers/facebook.php on line 43 and defined [CORE/Cake/View/Helper.php, line 144]
Notice (8): Undefined variable: View [CORE/Cake/View/Helper.php, line 145]
Notice (8): Undefined variable: View [CORE/Cake/View/Helper.php, line 146]
Notice (8): Trying to get property of non-object [CORE/Cake/View/Helper.php, line 146]
here is the appcontoller
class AppController extends Controller {
var $uses = array('Messages.Message', 'Settings', 'User');
var $components = array('Auth', 'Session');
var $helpers = array('Html', 'Form', 'Js', 'Session', 'Facebook.Facebook');
can some one help me please
Hi - I've been having a heck of a time getting this to work. I've followed these instructions step by step, but I can't seem to get this to work. When I call $this->Facebook->share() in home.ctp, it just tells me: Undefined property: View::$Facebook [APP/views/pages/home.ctp, line 3]. I'm obviously missing something simple, but I can't seem to figure it out! Please help!
When I click "Login with Facebook", with a valid Facebook account but not a valid account on my website (which is developed in CakePHP), I am logged into facebook, which is fine, BUT my session remains on my website and subsequently the logout button is displayed, which is misleading to the user, even though I have trapped the "error" and have displayed a customised message to the user to say they do not exist on my website. Can someone help? Thanks!
danieln, I think I know what happened with your first problem. You need to set the facebook_id in your db to bigint otherwise it will overflow and always be the max value of int. I don't know the answer to your second question though.
Hi,
Can you share a bit with me, I am facing a few problems here
1) I have the registration box on my login page, the problem is whenever a person clicks on the register, it creates a new line the users table. how to avoid this?
2) I have the login button on the same login page, but when I click on it, nothing happens.
Hope you can help me on this
After some research, I found he solution to my above mentioned issue. I just changed the following:
Configure::write('Security.level', 'low');
Credit goes to the post here:
http://groups.google.com/group/cake-php/browse_thread/thread/4d7807465be56b03?pli=1
Thank you for the wonderful plugin. I tested it out and everything worked great on my public url. But when I try to use the facebook link (apps.facebook.com/myapp, it always displays the login page. What could I have done wrong here?
Hi,
can someone share the codes you've used to successfully integrate FB into cakephp?
I'm not sure where mine go wrong, I really need a sample to compare it with.
Hi Nick, I have seen similar posts in multiple locations, but have never seen an answer yet. All that is working for me is "share" anything else that requires init() is not working. I have all the applicable things needed, API Key, etc... and have the FB html and init calls placed in the right spots... Still nothing. I even did a fresh install of cake thinking I might have had some conflicts and still nothing, only share is working. I tried the migrated tip below and that doesn't work. I love the idea of this plugin and from your example page I can see they work, however a couple days ago they didn't when I checked and I noticed you made some recent updates on Github thinking whatever you did fixed things, but still nothing. So, any ideas because I would LOVE to get this plugins full functionality working for my site.
Hi Nick,
Is there a way to redirect the user after Auth? Also - does it matter that the API Key is no longer told to us in Facebook? Just APP Id and Secret?
Regards,
Barry
Hi again Nick and to all the other people looking also for the solution to the "comments" problem ( see my comment before) I found the solution.
Facebook made obsolete the old facebook comments function, the new way to call it is :
- echo $facebook->comments(array('migrated'=> '1'));
Cheers
Murciano
Hi Nick, Before Anything Thanks for your great plugin! I am trying to make comments works on my web site but I saw that you have also the same error than me into your demo web site :
- Bad parameter : "There was an error understanding the request."
Do you know how we can fix this ?
i have tested echo $this->Facebook->share(); to know if the plugin was working,this worked without errors.i tried using echo $facebook->comments(); but the comment area is not showing.
I have included echo $this->Facebook->html() and $this->Facebook->init(); in the default layout. Its not displaying any error,neither is displaying the facebook comment.
I then changed the facebook plugin parameters to a wrong one. The echo $this->Facebook->share() still worked.what could be wrong.
/**
* Get an api_key and secret from facebook and fill in this content.
* save the file to app/config/facebook.php
*/
$config = array(
'Facebookx' => array(
'appId' => '',
'apiKey' => '',
'secret' => '',
'cookie' => true,
'locale' => 'en_US',
)
);
?>
what could be wrong
hey, great tutorial and an awesome plugin; however I seem to be running into some problems with it; it appears that the Facebook Connect component causes a redirection loop when using the Login button. Please advise
Hi Nick,
thanks for the video sharing!
I am trying your code here but sadly I can't even get the share button out on the page. I have put the plugin on the main plugin folder as per your example, but seems like it is not loaded at all.
any advice on where I should start looking from? I am using it with cakephp 1.3.10. the plugin I got it from "http://www.webtechnick.com/wtn/blogs/view/238/Facebook_Plugin_v2_0_Graph_System"
Another things is that facebook seems to have made some layout change this week and now the appID & API _key are the same. not sure if this could cause any effect on the plugin.
Hey friends. I try to figure out facebook user email. I used $this->authUser[$this->User->alias]['email'] = $this->session['email'] in connect.php file. But, it returns null and i am getting an error. I think, problem is $this->session['email']. Because when i use $this->authUser[$this->User->alias]['email'] = "example@example.com, it works. How can i save user email from facebook to my database? I need help!!!
Great tutorial, Nick. A problem I am having, though, is that I cannot find the "User" model anywhere. I want to make associations between the User model and other models (e.g., User HABTM Clubs), and I need to define those relationships in the User model, correct? If not, where do I define those relationships?
Hey, I have a problem I'm having a hard time to determine why/how it happens... While the user first opens the app, he is already logged-in to facebook (it's a canvas app). It is supposed to create a user if there's no user present with the same "facebook_id". It does create the user, but if in the mean time the user refreshes the page, it creates a duplicate, with same facebook_id and different id... Any idea how I can solve this?
@daydreamer: In the most recent version of the plugin (v2.4), I've added callback functions (beforeFacebookSave(), beforeFacebookLogin(), afterFacebookLogin()). You'll need to add some logic in your afterFacebookLogin() function to redirect to $this->redirect($this->Auth->redirect); Hope that helps
Hi Nick,
thanks for the plugin.
I am trying to create a FB app using this plugin.
However, when I'm trying to login using the default Auth, I get redirected to the page I initially wanted to be (but could because I wasn't authorized) after my login.
Using the plugin, the authentication works perfect, but I don't get redirected anymore and I stay on the login view.
Do you know how I can fix this?
Thanks
@markomarkovic Indeed, you have read it correctly. It's habit for me to disable all the settings when developing and then enable/disable as I need them in production. That's usually how I like to work in most scenarios. Arguably, I didn't go into enough detail in the screencast, but I felt I had to cover a lot of ground in the tutorial and it was somewhat out of scope. Hope that helps, Nick
Hi Nick, are you sure that you're configuring the deprecated FB settings correctly (on 3:00)? The way I read it is that when for example the "Disable Deprecated Auth Methods" is set to "Enabled" that they're actually disabled (because of the stupid FB wording) so when you're setting them to "Disabled" you're disabling the disabling of those methods and thus you're enabling them. Other options can also be backwards, for example "Stream post URL security" is enabled when enabled is checked. Am I completely wrong here or is FB wording really, really stupid?
Ha im lost in some parts :(, when I write Facebook->share(); ?> on home.ctp and visit my cakephp web only show "Facebook->share(); ?>" and when I add the other code in default.ctp (the code facebook->html() etc) I have an error, right now I dont have the error I'm going to check tomorrow and post it, I hope somebody can help me :) salu2 From Mexico
Debugging @VitorPacheco issue we discovered facebook_id in your database should be a BIGINT as some facebook user's id are too large to be held into an int(11). Please note that when following along in the screencast. Thanks, Nick
Thanks Nick. I really appreciate your sharing with the developer community like this.
I've built a tech demo that I am showing for a customer tomorrow.I decided to strip out the Auth stuff, because the demo doesn't need it. If my customer wants to proceed, then I may be in touch because I will need to get this working for the full project.
Thanks for the offer.
@VitorPacheco and @rlarcombe So if you're not logged in and do not allow 'display' to bypass Auth otherwise Auth will redirect you to users/login by default. If that doesn't help you, I'd be more than happy to take a look at what you're doing and point you in the right direction. nick@webtechnick.com
Brilliant!!! This is SO helpful. Exactly what I needed! Thank you for this amazing Pluggin, and for creating the screencast!
I had the same problem as @VitorPacheco though. I kept being redirected to the login page when trying to view the "users/myaccount" page (and the homepage for that matter), even though I was logged in with Facebook Connect and Auth working together. I don't think it was the redirect issue you mentioned because I was working on a live site, not localhost.localdomain.
Any ideas?
Could is still be related to the Facebook App's settings for Site URL and Site Domain??
Great screencast Nick. I could have used this a few months ago when I was blowing up your blog looking for advice. You were uber accommodating when I was having difficulties and I see that you are like that to everyone. Thanks for your patience and this awesome video!!!
@webtechnick I had already added these lines in my /etc/hosts ..
also tried with the ip of my LAN, I tried with these lines:
127.0.0.1 local.facebookexample
and / or
192.168.0.100 local.facebookexample
but neither worked ...
@VitorPacheco it sounds like you're running into the redirect issue described and solved here: https://github.com/webtechnick/CakePHP-Facebook-Plugin/issues/closed#issue/8
I discuss it in the screencast, when setting up the application. The trick is having localhost.localdomain point to your loopback IP (127.0.0.1).
Linux: /etc/hosts
Windows: c:\WINDOWS\system32\drivers\etc
Hope that helps,
Nick
I tried to run this application but, in time to access the home page after you have logged in using the facebook account, I am redirected to the login page again...
I tried to put the display action in authorizedActions and still the same thing..
something else from what I saw in their application a user is recorded only once in the database, but here each page refresh the user is recorded in the database.
sorry for bad english.
@lorenzo You are correct, although I wouldn't call it an error as the desired affect is the same. It would would have been better to verify the user is apart of a certain group/role but that was outside the scope of this tutorial.
Thank you for your feedback,
Nick
This tutorial has an error:
function isAuthorized() is only called if the user is logged in, so using the "if it's logged in it is authorized" is the same as returning true in the function
68 Comments