# Dex LDAP error when email does not match UID

**URL:** <https://discourse.openondemand.org/t/dex-ldap-error-when-email-does-not-match-uid/1643>\
**Category:** Get Help\
**Tags:** ondemand2, question\
**Created:** [August 24, 2021, 4:00pm UTC](https://discourse.openondemand.org/t/dex-ldap-error-when-email-does-not-match-uid/1643 "2021-08-24T16:00:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![caseyamcl](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/caseyamcl/32/803_2.png) [@caseyamcl](https://discourse.openondemand.org/u/caseyamcl)\
**Post date:** [August 24, 2021, 4:00pm UTC](https://discourse.openondemand.org/t/dex-ldap-error-when-email-does-not-match-uid/1643/1 "2021-08-24T16:00:14Z")

</div>

Hi,

I’m running into an issue with dex authentication against LDAP.

```auto
dex:
  connectors:
    - type: ldap
      id: ldap
      name: LDAP
      config:
        host: ldap.rcc.fsu.edu
        insecureSkipVerify: true
        bindDN: ******
        bindPW: ******
        userSearch:
          baseDN: ou=people,dc=rcc,dc=fsu,dc=edu
          filter: "(objectClass=posixAccount)"
          username: uid
          idAttr: uid
          emailAttr: mail
          nameAttr: uid
          preferredUsernameAttr: uid
        groupSearch:
          baseDN: dc=rcc,dc=fsu,dc=edu
          filter: "(objectClass=posixGroup)"
          userMatchers:
            - userAttr: DN
              groupAttr: cn

```

My uid is `cam02h`, but my email address is `cmclaughlin@fsu.edu`. When I try to login with this configuration, I get the following message:

```auto
Error -- can't find user for cmclaughlin
Run 'nginx_stage --help' to see a full list of available command line options.

```

It appears that the user mapping is based off everything before the “@” in the email address.

When I change my email address to match my uid (cam02h@fsu.edu), I can successfully login and see the dashboard.

Is there any way to allow dex logins where the email doesn’t match the uid?

---

<div class="post-metadata">

**Author:** ![caseyamcl](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/caseyamcl/32/803_2.png) [@caseyamcl](https://discourse.openondemand.org/u/caseyamcl)\
**Post date:** [August 24, 2021, 4:55pm UTC](https://discourse.openondemand.org/t/dex-ldap-error-when-email-does-not-match-uid/1643/2 "2021-08-24T16:55:34Z")

</div>

Nevermind; I just needed to restart the httpd service: `# systemctl restart httpd`

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [August 24, 2021, 5:00pm UTC](https://discourse.openondemand.org/t/dex-ldap-error-when-email-does-not-match-uid/1643/3 "2021-08-24T17:00:02Z")

</div>

What’s your `oidc_remote_user_claim` set to in the `ood_portal.yml`. Looks like the default is `preferred_username` which should be your uid given `preferredUsernameAttr: uid` setting in Dex.

Lol! just saw your comment, thanks for the update. I’ll leave mine here too just in case other folks come in and want to see/know more.

---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:42pm UTC](https://discourse.openondemand.org/t/dex-ldap-error-when-email-does-not-match-uid/1643/4 "2022-05-26T15:42:48Z")

</div>

Closed on May 26, 2022, 3:42pm UTC


