mahmoodr786/cakephp-auth0
Composer 安装命令:
composer require mahmoodr786/cakephp-auth0
包简介
CakePHP plugin for validating Auth0 JWT token and authenticating the user.
README 文档
README
Installation
composer require mahmoodr786/cakephp-auth0
Load the adaptor in your AppController. Add the code below to your initialize function.
$this->loadComponent('Auth', [ 'storage' => 'Memory', 'authenticate' => [ 'Form' => [ 'scope' => ['Users.status' => 1], ], 'Mahmoodr786/AuthZero.Auth0' => [ 'userModel' => 'Users', 'scope' => ['Users.status' => 1], 'client_id' => 'CLIENT ID HERE', 'secret' => 'SECRET HERE', 'fields' => [ 'username' => 'id', ], ], ], 'checkAuthIn' => 'Controller.initialize', ]);
That is it. Send a request to your app with the Authorization Bearer YourAuth0JWTToken header and you should have access to the user in your app.
debug($this->Auth->user());
Google and Facebook
To use Google and Facebook loging set it up using Auth0 add rule to Auth0 and sync the user's credentials in database. Add column to your user table in database called external_id and store the facebook|12323445 or google-oauth2|1234567 id in that field as you get it from Auth0. That should do it.
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-20