lubos/opauth

CakePHP Opauth plugin

Installs: 188

Dependents: 2

Stars: 6

Watches: 1

Forks: 61

Language: PHP

1.0.2 2014-03-21 10:46 UTC

README

Original source https://github.com/uzyn/cakephp-opauth

CakePHP 2.x plugin for Opauth.

Opauth is a multi-provider authentication framework.

Requirements

CakePHP v2.x
Opauth >= v0.2 (submoduled with this package)
Expandable

Installation

  1. Use composer. Add following to the composer.json file:

    "require": {
        "lubos/opauth": "~1.0"
    }
    

    And run php composer.phar update

  2. Download Opauth library as a submodule.

    git submodule init
    git submodule update
  3. Add this line to the bottom of your app's Config/bootstrap.php:

    <?php
    CakePlugin::load('Opauth', array('routes' => true, 'bootstrap' => true));

    Overwrite any Opauth configurations you want after the above line.

  4. Load strategies onto Strategy/ directory.

    Append configuration for strategies at your app's Config/bootstrap.php as follows:

    <?php
    CakePlugin::load('Opauth', array('routes' => true, 'bootstrap' => true));
    
    // Using Facebook strategy as an example
    Configure::write('Opauth.Strategy.Facebook', array(
       'app_id' => 'YOUR FACEBOOK APP ID',
       'app_secret' => 'YOUR FACEBOOK APP SECRET',
       'redirect' => '/'
    ));
  5. Go to http://path_to_your_cake_app/auth/facebook to authenticate with Facebook, and similarly for other strategies that you have loaded.

  6. After validateion you will be redirected to Opauth.Strategy.Facebook.redirect url

Note:

If your CakePHP app does not reside at DocumentRoot (eg. http://localhost), but at a directory below DocumentRoot (eg. http://localhost/your-cake-app),
add this line to your app's APP/Config/bootstrap.php, replacing your-cake-app with your actual path :

<?php // APP/Config/bootstrap.php
Configure::write('Opauth.path', '/your-cake-app/auth/');
Configure::write('Opauth.callback_url', '/your-cake-app/auth/callback');