2017 © Pedro Peláez
 

cakephp-plugin cakephp-opauth

Opauth plugin for CakePHP v3.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

image

00f100/cakephp-opauth

Opauth plugin for CakePHP v3.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  • Wednesday, December 2, 2015
  • by 00F100
  • Repository
  • 1 Watchers
  • 2 Stars
  • 538 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

CakePHP plugin for Opauth

CakePHP 3.x plugin for Opauth., (*1)

Opauth is a multi-provider authentication framework., (*2)

Requirements

  • CakePHP >= v3.0
  • Opauth >= v1.0

Using Composer

You can install CakePHP-Opauth plugin directly from Composer at wouter0100/cakephp-opauth., (*3)

How to use

  1. Install this plugin using Composer, add "wouter0100/cakephp-opauth": "*" to your Composer file and execute composer update., (*4)

  2. Add this line to the bottom of your app's config/bootstrap.php:, (*5)

    Plugin::load('Wouter0100/Opauth', ['routes' => true, 'bootstrap' => true]);
    
  3. Create a config/opauth.php file with the URL you wish to use for handeling the authentication data after opauth has run:, (*6)

    <?php
    
    $config['Opauth']['CompleteURL'] = '/auth/complete';
    

    You may want to add config/opauth.php to your gitignore, as the file will contain sensitive information., (*7)

  4. Load strategies using Composer for Opauth 1.0.0., (*8)

    Append configuration for strategies at your config/opauth.php file as follows:, (*9)

    // Using Facebook strategy as an example
    $config['Opauth']['Strategy']['Facebook'] = [
        'app_id' => 'YOUR FACEBOOK APP ID',
        'app_secret' => 'YOUR FACEBOOK APP SECRET'
    ];
    
  5. Go to /auth/facebook to authenticate with Facebook, and similarly for other strategies that you have loaded., (*10)

  6. After validation, user will be redirected to '/auth/complete' (or whatever you chose in the opauth.php config file) with validated auth response data retrievable available at $this->response->data., (*11)

    To route a controller to handle the response, at your app's config/routes.php, add a connector, for example:, (*12)

    $routes->connect(
       '/auth/complete',
       ['controller' => 'Users', 'action' => 'complete']
    );
    

    You can then work with the authentication data at, say src/Controller/UsersController.php as follows:, (*13)

    <?php
    namespace App\Controller;
    
    use App\Controller\AppController;
    
    class UsersController extends AppController
    {
       public function complete()
       {
           debug($this->request->data);
       }
    }
    

    Note that this CakePHP Opauth plugin already does auth response validation for you with its results available as a boolean value at $this->request->data['validated']., (*14)

Issues & questions

Used this plugin in your CakePHP project? Let us know!, (*15)

License

The MIT License
Copyright © 2012-2015 U-Zyn Chua (http://uzyn.com), further mentained by Wouter van Os (http://wouter0100.nl), (*16)

The Versions

02/12 2015

dev-master

9999999-dev http://opauth.org

Opauth plugin for CakePHP v3.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth