codesyntax / cs.auth.facebook

Facebook authentication plugin for Plone
6 stars 5 forks source link

Introduction

A PAS plugin to login into a Plone Site using Facebook.

Installation and getting started

  1. Buildout

    Add cs.auth.facebook to your buildout.cfg eggs list::

    [buildout] ... eggs = cs.auth.facebook

    Or as a required install dependency of your own addon setup.py::

    install_requires=[ ... 'cs.auth.facebook', ],

  2. Create a new Facebook app at https://developers.facebook.com/apps and fill in the required data in the plugin's control panel form. Make sure to enter the URL of the Website that is using the Facebook Login in App -> Facebook-Login -> Settings -> Valid OAuth Redirect URLs. If you want to run it from your local machine, you have to provide http://localhost:8080 and disable SSL-Enforcement.

  3. Install the product in the Plone Control Panel and provide the app_id and app_secret in the configuration panel.

    In Plone 4 you now see the "Facebook Login" button viewlet. To customize the placement of this viewlet please check out the Plone Viewlet Documentation <http://goo.gl/RyUORn>_

  4. Alternatively you can enable an action in portal_actions with the following configuration (see profiles/default/actions.xml within this package)::

    <object name="portal_actions" meta_type="Plone Actions Tool" xmlns:i18n="http://xml.zope.org/namespaces/i18n">

    Log in with Facebook string:${globals_view/navigationRootUrl}/@@facebook-login python:member is None False

  5. A second alternative is to link to the view ${globals_view/navigationRootUrl}/@@facebook-login where ever you want to start the facebook login.

Behind the scenes

The Facebook Login Viewlet uses the new Facebook JavaScript SDK v4.0 to ensure the proper popup for every target device. You don't have to care about this.

For more information on FB JSDK checkout the Facebook Developers Login Documentation <https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v4.0>_

Credit

This product re-distributes a lot of code written by Martin Aspeli (aka @optilude) in his book "Professional Plone 4 Development" and available under GPL license in his personal GitHub account with the name 'optilux.facebookauth':

https://github.com/optilude/optilux/tree/chapter-16/src/optilux.facebookauth

Compatibility

Plone 4.x

Plone 5.x