This repository was archived by the owner on Apr 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
This repository was archived by the owner on Apr 9, 2025. It is now read-only.
FriendOfCake's Crud plugin & Opauth not playing well together #37
Copy link
Copy link
Open
Description
Re: https://twitter.com/t1mmen/status/441512918950359040
When FriendOfCake's Crud plugin is loaded, Opath no longer works, giving the error message:
"No model loaded in the Controller by the name "Opauth". Please add it to $uses."
.. when trying to access http://localhost/myapp/auth/github. This works as expected when the Crud plugin is not setup in $components.
// AppController.php
public $components = array(
// Auth stuff
'Session',
'Auth' => array(
'loginRedirect' => array(
'controller' => 'pages',
'action' => 'display',
'home'
),
'logoutRedirect' => array(
'controller' => 'pages',
'action' => 'display',
'home'
),
),
// Crud scaffolder stuff
'RequestHandler',
// Enabling this breaks Opauth
// 'Crud.Crud' => array(
// 'actions' => array(
// 'index', // 'view', 'edit', 'delete', 'add'
// ),
// 'listeners' => array( // <- new
// 'api' => 'Crud.Api'
// )
// ),
);I installed Opauth using Composer:
{
"name": "myapp",
"repositories": [
{
"type": "pear",
"url": "http://pear.cakephp.org"
}
],
"require": {
"pear-cakephp/cakephp": ">=2.4.0",
"uzyn/cakephp-opauth": "dev-composer",
"opauth/google":"*",
"opauth/facebook": "*",
"opauth/github": "*",
"opauth/twitter": "*",
"friendsofcake/crud" : "3.*"
}
}
And my bootstrap.php has this part added:
// Load Composer autoload.
// Based on http://book.cakephp.org/2.0/en/installation/advanced-installation.html
require ROOT . DS . 'vendor'. DS . 'autoload.php';
// Remove and re-prepend CakePHP's autoloader as composer thinks it is the most important.
// See https://github.com/composer/composer/commit/c80cb76b9b5082ecc3e5b53b1050f76bb27b127b
spl_autoload_unregister(['App', 'load']);
spl_autoload_register(['App', 'load'], true, true);
// PLUGINS
CakePlugin::loadAll(array(
'Crud',
'Opauth' => array('bootstrap' => true, 'routes' => true),
));
Configure::write('Opauth.path', '/myapp/auth/');
// Stragegies configuration
Configure::write('Opauth.Strategy.Github', array(
'client_id' => 'x',
'client_secret' => 'y',
));My directory tree looks like this: https://www.dropbox.com/s/4pzmcpcqv75aqdn/Screenshot%202014-03-06%2013.03.21.png
Metadata
Metadata
Assignees
Labels
No labels
