Comments (11)
I see you have added 'finder' => 'auth'
for your Form
authenticator, why haven't you done the same for ADmad/HybridAuth.HybridAuth
's config?
from cakephp-hybridauth.
I also try that, I told on my message.
from cakephp-hybridauth.
I told on my message.
Not clear enough :) All you said was HybridAuth
does not return roles.
from cakephp-hybridauth.
I am using CakePHP 3.3.5. I also try using contain, which have been deprecated as of 3.1, but no roles return for HybridAuth. I also try my custom finder findAuth for HybridAuth, no change.
Yes, HybridAuth
does not return roles using 'finder' => 'auth'
in ADmad/HybridAuth.HybridAuth
's config
from cakephp-hybridauth.
HybridAuth does take the finder into account.
from cakephp-hybridauth.
This my new code:
$this->loadComponent('TinyAuth.Auth', [
'autoClearCache' => Configure::read('debug'),
// followings are common setting for auth component
'authenticate' => [
'Form' => [
'finder' => 'auth'
],
'ADmad/HybridAuth.HybridAuth' => [
'fields' => [
'provider' => 'provider',
'openid_identifier' => 'openid_identifier',
'email' => 'email'
],
'profileModel' => 'ADmad/HybridAuth.SocialProfiles',
'profileModelFkField' => 'user_id',
'hauth_return_to' => ['controller' => 'Users', 'action' => 'index', 'prefix' => false, '_ext' => null],
'finder' => 'auth'
]
],
'loginAction' => [
'controller' => 'Users',
'action' => 'login',
'prefix' => false
],
'loginRedirect' => [
'controller' => 'Users',
'action' => 'index',
'prefix' => false
],
'logoutRedirect' => [
'controller' => 'Users',
'action' => 'login',
'prefix' => false
],
'flash' => [
'element' => 'error',
'key' => 'auth'
],
// using bootstrap ui for flash element
'flash' => [
'element' => 'error',
'key' => 'auth'
],
'authorize' => [
// check authorization using TinyAuth based on config/acl.ini settings
'TinyAuth.Tiny' => [
'multiRole' => true,
'autoClearCache' => true,
'superAdminRole' => '01',
'rolesTable' => 'roles',
'pivotTable' => 'roles_users'
]
]
]);
And this my finder in UsersTable.php
public function findAuth(\Cake\ORM\Query $query, array $options)
{
$query
->contain(['Roles'])
->where(['Users.isactive' => 1,'Users.activationkey IS' => null]);
return $query;
}
Roles
not return.
from cakephp-hybridauth.
You can step through the code and check whether the finder you set is being used at the line i linked.
from cakephp-hybridauth.
That block executed, when a new user try to login with hybridauth
first time. But when user information save into database, after then when same user try to login using hybridauth
, that block not executed.
if ($profile && !empty($profile->user)) { // this is for old user
$user = $profile->user;
$profile->unsetProperty('user');
} elseif ($providerProfile->email) { // this is for new user
pr($config['finder']);
$user = $this->_userModel->find($config['finder'])
->where([
$this->_userModel->aliasField($config['fields']['email']) => $providerProfile->email
])
->first();
pr($user);
die();
}
from cakephp-hybridauth.
Okay, I see the problem. Will make a fix.
from cakephp-hybridauth.
I have made a new release with the fix.
from cakephp-hybridauth.
Thanks. It is working now.
from cakephp-hybridauth.
Related Issues (20)
- Error after cancel or deny facebook login. HOT 4
- Auth requested url redirect problem HOT 1
- Differentiate between the user who signs in or up HOT 6
- Why HybridAuth.SocialProfiles hasMany instead of belongsTo or hasOne ..? HOT 2
- Unable to login through facebook HOT 8
- Other Providers HOT 1
- Undefined index: login_done HOT 2
- hybridauth v2.10.0 class 'Hybrid_Auth' not found HOT 2
- Redirect to an additional form page after Authentication. HOT 2
- i need user friend list. it's possible HOT 2
- UTF8 problem with special display names
- Problem with database migration HOT 1
- Authentication adapter "ADmad/HybridAuth.HybridAuth" was not found. HOT 2
- Authentication adapter "ADmad/HybridAuth.HybridAuth" was not found.
- Annotations nullable
- Remember Me option?
- Not working anymore? HOT 2
- 'bin' is not recognized as an internal or external command, on Windows 10 HOT 1
- Cake4 beta
- Composer v2 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cakephp-hybridauth.