lubos / opauth
CakePHP Opauth plugin
Installs: 306
Dependents: 2
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 61
Type:cakephp-plugin
Requires
- php: >=5.2.8
- cakephp/cakephp: ~2.0
- composer/installers: ~1.0
- lubos/expandable: ~1.0
This package is auto-updated.
Last update: 2024-11-04 19:54:14 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
-
Use composer. Add following to the
composer.json
file:"require": { "lubos/opauth": "~1.0" }
And run
php composer.phar update
-
Download Opauth library as a submodule.
git submodule init git submodule update
-
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.
-
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' => '/' ));
-
Go to
http://path_to_your_cake_app/auth/facebook
to authenticate with Facebook, and similarly for other strategies that you have loaded. -
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');