forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: paterczm on June 18, 2011, 12:18:32 pm

Title: Facebook Authentication plugin
Post by: paterczm on June 18, 2011, 12:18:32 pm
Facebook authentication plugin for Coppermine. This is not a bridge, it will not affect existing Coppermine users in any way - standard login and user registration is still available.

Requirements

Installation
1. First you need to register your gallery as a facebook application [3]. Continue this steps when you've got Application ID and App secret.
2. Install FirePHPCore 0.3.2 [1]. This is a logging library which makes PHP development a little less annoying. You can put it in the root of your page (in /FirePHPCore).
3. Create an url rewrite rule from facebookauth.php to index.php?file=facebookauth/facebookauth.php, e.g. if your gallery is available at http://yourdomin/gallery/, create http://yourdomin/gallery/.htaccess file with following contents:
Code: [Select]
RewriteEngine On
RewriteRule ^facebookauth.php$ /gallery/index.php?file=facebookauth/facebookauth&%{QUERY_STRING} [PT,L]
If you're having problems with this step, consult Apache documentation and/or your hosting service provider.
4. Install the plugin
5. Use phpMyAdmin to set plugin_facebookauth_* configuration parameters:
6. Open the login.php page and click the link above the login form: "Login via facebook"
7. Login to facebook, if not already logged in. Then you will need authorize the gallery to access some personal information (see facebook authentication documentation [4] for details).
8. New user account is created in Coppermine; you should now be logged in.

Why the url rewrite rule?
For some reason, facebook api doesn't like this url: index.php?file=facebookauth/facebookauth.php, even when it's properly escaped. Url rewrite rule is a way to make it work while complying with Coppermine url conventions.

Javascript Overlay Features

Security
This modification should be as safe as Coppermine and facebook authentication api.

Privacy

Known Issues

Demo
If you want to try it out, go to http://www.marek-paterczyk.waw.pl/gallery/, open any picture, then click on "Login via facebook" link below comment section. You can delete your account afterwards if you want.

[1] http://www.firephp.org/
[2] http://www.facebook.com/
[3] https://www.facebook.com/developers/
[4] http://developers.facebook.com/docs/authentication/
Title: Re: Facebook Authentication plugin
Post by: LaLLe on July 29, 2011, 09:08:14 am
Great Plugin, but I run into trouble when trying to use it with phpbb2.0.18 bridging. Works flawlessly when bridging is off.
All I get is a database query problem message.
Title: Re: Facebook Authentication plugin
Post by: ryansdistrict on August 07, 2011, 03:16:44 am
all gone wrong !
i installed the script in the wrong way i just  uploaded the plugin without doing previous steps and here is the result
http://lebanese.in/photos/
please can u help me fix this or remove it

Thanks
Title: Re: Facebook Authentication plugin
Post by: paterczm on August 07, 2011, 11:27:11 am
LaLLe:
I think I know why it doesn't work with bridging, I hardcoded column fields in my queries. They should be taken from bridging configuration. I didn't pay attention to this because I'm not interested in the bridging feature. Should be easy to fix for someone with bridging set up ;)

ryansdistrict:
Use plugin manager to remove it. If you want to get it to work, please execute all the steps.
Title: Re: Facebook Authentication plugin
Post by: profili on August 15, 2011, 10:57:48 pm
I'm not sure about step 2. How to install FirePHPCore 0.3.2?
Title: Re: Facebook Authentication plugin
Post by: paterczm on August 16, 2011, 12:10:57 pm
I'm not sure about step 2. How to install FirePHPCore 0.3.2?

Download it from http://www.firephp.org/, unpack and upload to /FirePHPCore directory on your server.
Title: Re: Facebook Authentication plugin
Post by: profili on August 16, 2011, 12:57:23 pm
Thats all, just unpack and upload?
Title: Re: Facebook Authentication plugin
Post by: profili on August 16, 2011, 01:06:31 pm
I'm unsure about steps 4 and 5 too.

4. Install the plugin - just install or should I activate it too? I ask because I did it and it ruined my whole gallery.

5. Use phpMyAdmin to set plugin_facebookauth_* configuration parameters: - How and where do I do this with phpMyAdmin. A step by step guide please.

Title: Re: Facebook Authentication plugin
Post by: Gutty on August 17, 2011, 10:17:24 am
awesome plugin, im halfway through installing it, but come to a bit of a crossroads...

Quote
5. Use phpMyAdmin to set plugin_facebookauth_* configuration parameters:
Set plugin_facebookauth_application_id with the Application ID you got in step 1
Set plugin_facebookauth_application_secret with the App secret you got in step 1
Set plugin_facebookauth_firephp_path with relative path to Fire PHP, e.g. if your gallery is available at http://yourdomin/gallery/ and Fire PHP is available at http://yourdomain/FirePHPCore, then the default value "../FirePHPCore" is correct.

in phpmyadmin, there is only plugin_facebookauth_users.
should i be adding a query to put the other values in? as there are none currently.
this is what shows up for me...(see attached screenie)

Please advise what to do here...
thanks team
Title: Re: Facebook Authentication plugin
Post by: paterczm on August 18, 2011, 11:53:04 am
in phpmyadmin, there is only plugin_facebookauth_users.
should i be adding a query to put the other values in? as there are none currently.

Hello Gutty. <cpg_prefix>_plugin_facebookauth_users will contain names of logged in users. Plugin properties can be found in <cpg_prefix>_config.
Title: Re: Facebook Authentication plugin
Post by: paterczm on August 18, 2011, 11:55:07 am
I'm unsure about steps 4 and 5 too.

4. Install the plugin - just install or should I activate it too? I ask because I did it and it ruined my whole gallery.

5. Use phpMyAdmin to set plugin_facebookauth_* configuration parameters: - How and where do I do this with phpMyAdmin. A step by step guide please.

4. Yes, install and activate. How did it ruin your gallery?
5. Please look at my recent reply to Gutty.
Title: Re: Facebook Authentication plugin
Post by: Gutty on August 18, 2011, 12:25:27 pm
awesome, thanks for that. all working and looks awesome. i had to make sure my canvas url was right though. just left it blank and it worked.

maybe state in your first post that the info is in config_ section of phpmyadmin.

thanks for the plugin :p
Title: Re: Facebook Authentication plugin
Post by: paterczm on August 18, 2011, 02:57:41 pm
maybe state in your first post that the info is in config_ section of phpmyadmin.
I would, but I don't see a way to edit it now...
Title: Re: Facebook Authentication plugin
Post by: Martur on August 20, 2011, 12:42:02 pm
In step 3 I did as described but when activating the plugin no page of the gallery is loading with the error message:
Code: [Select]
Fatal error: require_once() [function.require]: Failed opening required '../FirePHPCore/FirePHP.class.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/clients/client1/web11/web/Wedding/cpg15x/plugins/facebookauth/codebase.php on line 23
Then I installed FirePHPCore from pear with success but it still does not work. I even copied the FirePHPCore directory to /usr/share/php but that did not help either...
Title: Re: Facebook Authentication plugin
Post by: Martur on August 20, 2011, 12:43:20 pm
Sorry, I meant step 2 in the above post
Title: Re: Facebook Authentication plugin
Post by: paterczm on August 20, 2011, 03:18:02 pm
In step 3 I did as described but when activating the plugin no page of the gallery is loading with the error message:
Code: [Select]
Fatal error: require_once() [function.require]: Failed opening required '../FirePHPCore/FirePHP.class.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/clients/client1/web11/web/Wedding/cpg15x/plugins/facebookauth/codebase.php on line 23
Then I installed FirePHPCore from pear with success but it still does not work. I even copied the FirePHPCore directory to /usr/share/php but that did not help either...

Since cpg15x is your gallery directory, you should put FirePHPCore in /var/www/clients/client1/web11/web/Wedding/ in order for the default include path (../FirePHPCore) to work. Or you can put it somewhere else and change the FirePHPCore path with plugin_facebookauth_firephp_path setting.
Title: Re: Facebook Authentication plugin
Post by: Martur on August 21, 2011, 06:11:12 pm
I changed that but now I am running into new problems. The Login link is displayed but it is pointing to a page that does not exist. I guess it should point to GALLERY/plugins/facebookauth/facebookauth.php but instead it goes to GALLERY/facebookauth.php

Title: Re: Facebook Authentication plugin
Post by: paterczm on August 21, 2011, 06:35:37 pm
I changed that but now I am running into new problems. The Login link is displayed but it is pointing to a page that does not exist. I guess it should point to GALLERY/plugins/facebookauth/facebookauth.php but instead it goes to GALLERY/facebookauth.php
Please execute step 3 from setup instructions. You'll find additional explanations in 'Why the url rewrite rule?' section.
Title: Re: Facebook Authentication plugin
Post by: paterczm on October 15, 2011, 02:10:56 pm
New version, with 2 additional features:
* Notify admin when a new cpg account is created by this plugin (plugin_facebookauth_newuser_notify property, default 1)
* Disallow first time users, i.e. facebook authentication will work only fork existing cpg accounts (plugin_facebookauth_newuser_allow property, default 1)
Title: Re: Facebook Authentication plugin
Post by: streetstars on February 20, 2013, 12:52:54 pm
Guys,

iam not getting any were here

i have done as said but iam only getting a white screen now when iam accessing the gallery site.

It is also not givng me the login via facebook option although the settings are set right.

Pls let me know what you need
Title: Re: Facebook Authentication plugin
Post by: Niecher on March 13, 2013, 01:32:11 pm
Very good plugin, great job.

I have a question

What is the password for the user created by the plugin via facebook, the password can be changed by the user?

thank you very much.
Title: Re: Facebook Authentication plugin
Post by: paterczm on May 18, 2013, 09:48:42 pm
What is the password for the user created by the plugin via facebook, the password can be changed by the user?

The password created for facebook users is a random string. Users cannot change it, the only way to reset the password is by direct db manipulation. Coppermine accounts created by the facebookauth plugin are intended for facebook authentication only.
Title: Re: Facebook Authentication plugin
Post by: Niecher on May 19, 2013, 01:43:47 pm
Thank you very much for your answer, paterczm.