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

CommentFileSizeAuthor
#4 3520596-1.patch1.85 KBhimanshu_jhaloya
Command icon 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

    whikloj created an issue. See original summary.

    abhishek_gupta1’s picture

    himanshu_jhaloya’s picture

    Assigned: Unassigned » himanshu_jhaloya

    Working on the issue

    himanshu_jhaloya’s picture

    Assigned: himanshu_jhaloya » Unassigned
    StatusFileSize
    new1.85 KB

    Created Patch for the issue Please review.

    himanshu_jhaloya’s picture

    Status: Active » Needs review
    whikloj’s picture

    Status: Needs review » Active

    I have removed my changes and applied the patch in #4 and it is working for me.

    whikloj’s picture

    Status: Active » Needs review
    rtvenge’s picture

    Removed comment. :/

    vengat_the_wizard’s picture

    Version: 4.0.20 » 5.0.2
    Assigned: Unassigned » vengat_the_wizard
    Status: Needs review » Fixed

    This issue has been addressed and the fix is included in release 5.0.2 .

    Now that this issue is closed, review the contribution record.

    As a contributor, attribute any organization that helped you, or if you volunteered your own time.

    Maintainers, credit people who helped resolve this issue.

    vengat_the_wizard’s picture

    Status: Fixed » Closed (fixed)