Problem/Motivation
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.
Steps to reproduce
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));
}src/Controller/miniorange_oauth_clientController.php - line 149
user_load_by_mail is not case insensitive. See https://www.drupal.org/project/drupal/issues/2876155
Proposed resolution
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.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|
Issue fork miniorange_oauth_client-3520596
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
abhishek_gupta1 commentedComment #3
himanshu_jhaloya commentedWorking on the issue
Comment #4
himanshu_jhaloya commentedCreated Patch for the issue Please review.
Comment #5
himanshu_jhaloya commentedComment #6
whiklojI have removed my changes and applied the patch in #4 and it is working for me.
Comment #7
whiklojComment #8
rtvenge commentedRemoved comment. :/
Comment #9
vengat_the_wizard commentedThis issue has been addressed and the fix is included in release 5.0.2 .
Comment #11
vengat_the_wizard commented