flipboxfactory / saml-sp

SAML Service Provider (SP) Plugin for Craft CMS
https://saml-sp.flipboxfactory.com/
Other
19 stars 5 forks source link

Server error in Craft after redirect from Google IDP #107

Closed rostockahoi closed 3 years ago

rostockahoi commented 3 years ago

Hi there, I have an error with Google SSO.

What happens

Fix

I am able to fix the error and everything works just fine by putting the following line above User.php:145: $user->email = $user->usename;

I feel like I am missing some configuration, do I?

Exception output

2021-04-09 18:42:42 [-][-][86nq472enlj7bpklnsff7ehglf][error][saml-sp] User save failed: {"email":["E-Mail darf nicht leer sein."]}
2021-04-09 18:42:42 [-][-][86nq472enlj7bpklnsff7ehglf][error][yii\base\UserException] yii\base\UserException: User save failed: {"email":["E-Mail darf nicht leer sein."]} in /path/to/craft/vendor/flipboxfactory/saml-sp/src/services/login/User.php:172
Stack trace:
#0 /path/to/craft/vendor/flipboxfactory/saml-sp/src/services/login/User.php(145): flipbox\saml\sp\services\login\User->save()
#1 /path/to/craft/vendor/flipboxfactory/saml-sp/src/services/Login.php(68): flipbox\saml\sp\services\login\User->sync()
#2 /path/to/craft/vendor/flipboxfactory/saml-sp/src/controllers/LoginController.php(112): flipbox\saml\sp\services\Login->transformToUser()
#3 [internal function]: flipbox\saml\sp\controllers\LoginController->actionIndex()
#4 /path/to/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#5 /path/to/craft/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams()
#6 /path/to/craft/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction()
#7 /path/to/craft/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction()
#8 /path/to/craft/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction()
#9 /path/to/craft/vendor/yiisoft/yii2/web/Application.php(104): craft\web\Application->runAction()
#10 /path/to/craft/vendor/craftcms/cms/src/web/Application.php(259): yii\web\Application->handleRequest()
#11 /path/to/craft/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest()
#12 /path/to/craft/web/index.php(21): yii\base\Application->run()
#13 {main}
dsmrt commented 3 years ago

:wave: @rostockahoi

Do you have email mapping configured on the IdP Edit page?

I have one instance mapped from the Google side like this: Screen Shot 2021-04-09 at 11 41 41 AM

Then from the Craft side like this: Screen Shot 2021-04-09 at 11 43 24 AM

rostockahoi commented 3 years ago

Works like a charm, thank's a lot for that fast response.