Facebook Login Plugin - Page 2 Facebook Login Plugin - Page 2
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Facebook Login Plugin

Started by omnitool, July 11, 2010, 08:34:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

purplefreak3

Sorry in advance for being clueless but where would I add/edit this information (code above) on adjusting the way a button is added to the menu?

Αndré


DigitalMind

I can't seem to get this working on demotivationalpics.com ..

I created a facebook application page, I have the secret and app Id, I filled in all the details in codebase.php .. installing the plugin does in fact add the connect with facebook button, but when I click it and enter my facebook password, it simply brings me to my facebook account. 

The youtube video about setting up the facebook application seems out of date since some of the facebook settings are changed.

Any idea's ??  I get the feeling it has something to do with the facebook app end, and not the plugin since it's fairly straight forward.

For the moment I will leave the plugin active on demotivationalpics.com in case anyone wants to try it. 

Thanks guy !
Jason

1aB

#23
@DigitalMind: I got the same problem, looked at the plugin code and played with it a bit...
I run Coppermine in an Apache with the prefork MPM (on Debian Lenny) ...but as far as my fair Apache knowledge and my dim PHP knowledge goes, I think this plugin could only work under Windows (mpm_winnt) or certain mpm_worker configurations, due to the use of the $facebook global variable.
Is that true? Does that match observations? Anyone working actively on this at the moment?
Anyway, I would like to modify this plugin, hoping that I'll have some changes that it would work for me, and then share it here. Give me a week for a start... ;-)

Quinn

I have CPG 1.5.12 bridged with SMF 1.1.12.
SMF has Facebook Connect installed via SA FBConnect

Would / could this be extended to integrate with Coppermine and add a LIKE Button to the template?

1aB

I came as far as this for now:

  • It works for me  ;)
  • Most important change is that there is now a mapping table {$CONFIG['TABLE_PREFIX']}plugin_fb_oauth_usermap between Coppermine user_id and the Facebook uid, which should offer a lot of flexibility:

    • No more dependency of usernames and passwords; both can now be changed afterwards for the Facebook-coming users.
    • The default Coppermine password for the Facebook-coming users is now actually secure (=random with a length of 40 chars). They will probably never need it, but they could change it if they'd want to log in to Coppermine directly and without Facebook.
    • If you are not shy about SQL and finding out the Facebook uid values for your friends, you can manually INSERT INTO the mapping table to reuse existing Coppermine accounts with Facebook's Single Sign-On.
  • Configuration moved to fb_init.php
  • New config option (still no config gui) for the default Coppermine group in which you want the Facebook-coming users to be
  • Some changes as to how the buttons are added and their texts, also to reduce confusion between the two login buttons

Some Todos that I would still see:

  • Facebook login button as with the LoginForm plugin
  • Require Facebook-coming users in a certain Coppermine group (useful?)
  • Automatically set some Coppermine group memberships based on Facebook's pages(?)/events(?)/groups(?)/lists(?), should be configurable
  • Make this a bridge rather than a plugin
  • GUI... lots of GUI stuff

Hope that this might work for others, too, and also that the functionality is not only what I need but that others might also want/need it like this...

Ziptrax

Invalid API key specified

The app you are trying to access does not exist or has been disabled.



Just tried this latest version and thats what i get

When i try and use it to log into my site at www.share-snaps.com
I will leave it on there so you can have a look at it if you want.

1aB

#27
Hi,

saw your post, tried to go to your site but did not find it there.

Well -- the app key/app id and secret that you need to put into fb_init.php is something that you need to get from facebook by registering your gallery/site as an application with them at http://developers.facebook.com/setup/ -- there were some original instructions in this thread's initial post.

One thing I had initially done wrong was to mix up the app key and app id. But I am not sure whether Facebook's own wording of them is actually consistent. :-)

Hope this helps :-)
Roland

1aB

I managed to add a few more things:

  • Facebook autologin - there has been code for this before, but I do not know how it could have worked. (It did not work for me.) This new feature is optional and needs to be enabled explicitly, because I suppose some gallery admins might not want it.
    What does it do? It tries to detect whether someone who is not logged on to the gallery, is logged on to Facebook -- and then automatically logs him in to the gallery, too, without needing a mouse click.
  • Configuration GUI via the plugins page (finally!), and also have a few words there about the basic usage and that it needs a Facebook App Registration
  • Optionally add the big ugly(?) Facebook login button, with configurable HTML markup for (absolute) positioning. This should also address the problem that some themes (->curves? others?) prevent the "normal" button from being added to the layout
  • Stay on same Coppermine page during Facebook login and also logout (no more redirecting to gallery index)
  • If CPG setting comment_promote_registration is enabled, customize the text to not only promote normal login but also Facebook login


Some proactive support attempts :-) Because I know that this beast is indeed very complicated and not easy to manage/troubleshoot.

If you should have a problem with the login process, try to find out where exactly it stops from working. Tools like LiveHttpHeaders or IEhttpHeaders might help with that.

There can be actually three... well... four ways how it can go wrong:

  • AppId/Secret are wrong (= not identical with the Facebook App Registration)
  • In the Facebook App Registration the specified page URL is wrong (= not identical with the actual Gallery URL)
  • Something inside Coppermine prevents the login
  • Still some problem with the plugin code...

If you should have a problem with the new v1.4 autologin feature

  • Have you enabled it in the plugin settings?
  • Please wait for a moment. For me it seems to take a few seconds until the check is done and the gallery is reloaded in logged-in state
  • Some browsers might prevent a page from being refreshed. They shouldn't! Maybe even some too-strict browser security model (private mode?) might prevent this from working.
  • Oh, please do not make me go back to the code for this :-) I hate Javascript quite much...

BTW, has anyone else than me managed to get this working yet?
It would be great if someone could offer his working Facebook-login-able gallery for others to double-check on the login process (i.e. what a correct login process looks like in liveHttpHeaders).
Unfortunately I cannot share mine (at this time) because it has too little bandwith, sorry.


Some background about why I am doing this:
I have a small Coppermine gallery with lots of photos of people, friends and events where I have been asked to be a photographer. Definitely not the type of photos that one would want to share publically, so I have them secured via several different Coppermine groups. This approach works quite well, but there are some problems of the type of "password forgetting" and "group accounts".
So what I am trying to achieve is to keep my strict fine-grained Coppermine security model, and just map Facebook users to it, so that I can give the Facebook users persmissions to see those pictures that I want them to see, and ideally I would want to give those permissions in advance. I could then avoid "group accounts", and password remembering should then not be an issue with the users anymore, either...

I suppose that this approach is probably quite different from what others would like to achieve with Facebook integration. But maybe this is useful for you, too, though.


Future plans (beyond what I wrote previously):
Oh, I have just yesterday discovered that VZ (studiVZ/meinVZ) seems to have a similar login API as Facebook. And wondering whether to use it would make sense in the scope of this plugin (then probably better renaming to "social_login" plugin  ;)) -- or better to create a separate vz-login-plugin, but then in a way that both could be used at the same time.
Not making any promises!

spider666

Hello. First thanks for your fantastic job !

I use the "curve" and "curve_black" theme and I can not see the "login via facebook" in the menu :-(. I see it on the "water_drop" theme. Little help is verry welcome.

Thanks in advance

1aB

Okay, a special one for the "curve" users  ;)
Try this one and enable the "brute force" option -- whether it manages to change the sysmenu then.

Experts, please compare the source code for the "brute force" approach and the normal one -- which one is cleaner? (I would think the normal one is cleaner.)

spider666

Many thanks, it's running with brute force :-)

juwy

Hi,
I just installed coppermine and also instantly got cpg1.5.x_plugin_fb-oauth_v1.2 to work... great :-)
.. but ...
I uncommented



$login_params = array(
'req_perms' => 'email'
);



in fb_init.php but neither does facebook ask if the user wants to share his email with the app nor does the email appear in coppermines user management. Even if I am trying to require extended permissions by the req_perms parameter there is no change in facebooks behaviour.
Any help?

1aB

Need to look into that but since I have been trying with some other Facebook API calls as well and they seemed to work in an entirely different way (not via the $facebook object), it's possible that this part with the extended permissions may need reworking, too...

1aB

Hi,

as far as I could see that $login_params array works ok for the customized menu entry. The one that used to not show up with the curves theme ;-)

But not for the "big ugly" Javascript button. For that one it takes <fb:login-button perms="email"> instead of <fb:login-button> to make Facebook request the permission.

Maybe to copy the email from the Facebook profile to the Coppermine profile does not work properly at this time... I do not know... feel free to experiment with it ;-)

CU
Roland

1aB

Just to share what I managed to add so far. Sorry I did not deal with the Facebook perms issues yet. Hardly getting round to do anything these days  :-\

But if you should have nonpublic albums, v1.5 can now show on the thumbnails page who of one's Facebook friends are also allowed to see them. It might help Facebook-coming users better orientation to judge what they can see vs. what their friends can see in the gallery.

For those of you who want to play with the Facebook-interfacing code, note the use of the $facebook object in the old code versus the json_decode(file_get_contents('https://graph.facebook.com/...')) style code for this new feature. Despite the first one seems more object-oriented, I think I like the latter approach better... seems to be more kinda-direct...

payam

Hi, do you have any updates to the plugin? Chrome doesn't seem to like it and I'm having trouble logging in normally (without facebook) once I have checked marked the automatically detected if they are signed in facebook.

spider666

I receive this from Facebook about the Auth and I don't know what I have to do with this. This is directely in relation with your plugin I think.

My question are, can I update ? and if yes where exactely. Is your code "compatible" ?

Sorry, I'm not a coder, so all this is a bit confused

Thanks for your help

-----------------------------------------------


Dear Developer of XXXXX

Our automated systems have detected that you may be inadvertently allowing authentication data to be passed to 3rd parties. Allowing user ids and access tokens to be passed to 3rd parties, even inadvertently, could allow these 3rd parties to access the data the user made available to your site. This violates our policies and undermines user trust in your site and Facebook Platform.

In every case that we have examined, this information is passed via the HTTP Referer Header by the user's browser. This can happen when using our legacy authentication system and including <iframe>, <img> or <script> content from 3rd parties in the page that receives authentication data from Facebook. Our legacy mechanism passes authentication information in the URL query string which, if handled incorrectly, can be passed to 3rd parties by the browser. Our current OAuth 2.0 authentication system, released over a year ago, passes this information in the URL fragment, which is not passed to 3rd parties by the browser.

Please ensure that you are not allowing this data to be passed immediately. Accessing your site as a test user while running a HTTP proxy/monitor like Charles or Fiddler is the best way to determine if you are allowing this information to be passed. If you discover the issue, you can do one of two things:

1. Migrate your site to use our OAuth 2.0 authentication system. We are requiring all apps and sites to update to this mechanism by Sept. 1, 2011. Migrating now will address this issue and ensure that you are one of the first to meet the deadline. For more details, please see our Authentication Guide.

2. Create and use an interstitial page to remove the authentication data before redirecting to your page with 3rd party content. This approach is used by many of our largest developers today (although they are all migrating to OAuth 2.0 shortly). This is a simple and straightforwardchange that should have minimal impact on your site. For more details on this approach, see our Legacy Connect Auth doc.

Because of the importance of ensuring user trust and privacy, we are asking you to complete one of the above steps in the next 48 hours. If you fail to do so, your site may be subject to one of the enforcement actions outlined in our policies.

If you have any questions or believe you have received this message in error, please contact us.

Facebook Developer Relations

rickmick

I can't believe that a plugin like this is dead in the water. With all the people using facebook login, Coppermine is so far behind.

rickmick

I have it working for me. In the file fbconnect.php, on line 429, I changed

'login.php',

To

'dialog/oauth',

If you login using your facebook at least one time and you want to logout, and login to your admin username, you must delete your cookie that starts with fsb_ and ends with your AppId number. Always remember to backup your database and have an extra admin user before loading a plugin.