- Issue created by @whikloj
Trying out the base module against a Microsoft Entra provider.
I have an account in Drupal and in the tenant, but it after a successful login to the OAuth provider it tells me "User not found in Drupal".
Enabling logging shows
miniorange_oauth_clientController.php, miniorange_oauth_client_mo_login , 155: User does not exists.
Try to login when your email address is not all lower case.
The email attribute returned by Entra is correct but is run through strtolower
in
$account = '';
if (!empty($email)) {
$account = user_load_by_mail(strtolower($email));
}
user_load_by_mail
is not case insensitive. See
https://www.drupal.org/project/drupal/issues/2876155
🐛
Functions to load user by name or email should be case insensitive
Active
I altered the code to run
$account = '';
if (!empty($email)) {
$account = user_load_by_mail(strtolower($email));
if (!isset($account->uid)) {
$account = user_load_by_mail($email);
}
}
This solved the issue for me, but maybe there is a better solution.
Active
4.0
Code