sfLinkedInPlugin - 0.8.0

The purpose of this plugin is to facilitate the implementation of authentication via LinkedIn. sfLinkedInPlugin is an implementation of the OAuth library (open protocol to allow API authentication in a simple and standard method from desktop and web applications) to authenticate users via their LinkedIn account. In addition, sfLinkedInPlugin makes easy the integration of the linkedin javascript framework

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source

sfLinkedIn plugin

sfLinkedInPlugin helps to integrate oauth library to allow users to authenticate to your website via linkedin. For more information: http://developer.linkedin.com/docs/DOC-1008

Other units, it allows integration javascript API to authenticate users via javascript framework IN. For more information: http://developer.linkedin.com/docs/DOC-1225


This plugin for symfony 1.2 to 1.4 depends to propel.


currently, this plugin is in alpha version. please wait for a stable version to use it in production environement.

The easiest way to install sfLinkedInPlugin is to use the symfony command line:

> symfony plugin:install sflinkedInPlugin --stability=alpha

Alternatively, if you don't have PEAR installed, you can download the latest package attached to this plugin's wiki page and extract it under your project's plugins/ directory. You can also refer to the plugin's Subversion repository by doing a checkout or an svn:externals of http://svn.symfony-project.com/plugins/sfLinkedInPlugin

2 - Build the data structures

Rebuild the model and generate the SQL code for the new tables:

> php symfony propel:build-model
> php symfony propel:build-sql

Create the new table in your database. Use the generated data/sql/plugins.sflinkedInPlugin.lib.model.schema.sql file for that purpose. For instance, with MySQL:

> mysql -uroot -p mydb < data/sql/plugins.sflinkedInPlugin.lib.model.schema.sql

3 - Configure your project to use the plugin features

Enable the sfLinkedIn module in your frontend application, via the settings.yml file.

// in myproject/apps/frontend/config/settings.yml
    enabled_modules:        [default, sfLinkedIn]

add a new route for the back url into your routing.yml file:

  url:   /likedIn-authenticate/*
  param: { module: sfLinkedIn, action: accessToken }

configure the app.yml, you can just override values in the app.yml with this plugin:

consumer_key: copy & paste your api key generated when creating your linkedin application
consumer_secret: copy & paste your api secret key generated when creating your linkedin application
back_url: it's the new route added in routing.yml
debug: ON|OFF  

6 - You can now start using the plugin by browsing to the module's default page:


Customize to your application

All generic work was putted in modules/sfLinkedIn/lib/BasesfLinkedInActions.class.php

to customize this plugin to your own application, you should refer to modules/sfLinkedIn/actions/actions.class.php After authenticating via linkedIn we execute executeAuthenticate action, so in the example, we have prepared a form. this form will be used to get the user-email. Because, we have all linkedIn user informations but not the email. the email is key, we use it to: 1-identify the user in our website if the email exist in our database. 2-create a new user using his email and his linkedIn profile.

the method authenticateTrigger , it is called when user try to use linkedIn authentication and he is already registred in our database. i putted an example to how override that method.

the method processForm, used when user send us his email, in the example we have 2 choices: 1- mail not exist => we create a new user 2- mail exist => we associate the user to his linkedin profile.

To do

this was the oauth linkedin part. Next time, i will put a documentation for how to use the linkedin javascript framework.