# SSO Authentication Issue with differently cased emails

**URL:** https://meta.discourse.org/t/sso-authentication-issue-with-differently-cased-emails/67273
**Category:** Support
**Created:** [August 1, 2017, 11:08pm UTC](https://meta.discourse.org/t/sso-authentication-issue-with-differently-cased-emails/67273 "2017-08-01T23:08:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Martin\_Cash](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin_cash/32/73218_2.png) [@Martin\_Cash](https://meta.discourse.org/u/Martin_Cash)
#### Post date: [August 1, 2017, 11:08pm UTC](https://meta.discourse.org/t/sso-authentication-issue-with-differently-cased-emails/67273/1 "2017-08-01T23:08:02Z")

</div>

Today, I had a case of a member that would be redirected to the “confirm your email address” page every time they signed in to Discourse. They are able to sign in to other assets that use our authentication method just fine.

After some digging, we found that the email address stored in Discourse and on our authentication server had capital letters which they don’t actually type when signing in to anything. I had the member change their ID to lowercase and now they can sign in to Discourse without a problem.

I asked my authentication dude if I should send a ticket to him and he recommended i notify you guys as this “seems like a Discourse issue.”

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 1, 2017, 11:54pm UTC](https://meta.discourse.org/t/sso-authentication-issue-with-differently-cased-emails/67273/2 "2017-08-01T23:54:33Z")

</div>

Hmm did we regress here @LeoMcA ? Make sure your code is case independent for many-to-one emails to users.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [August 2, 2017, 2:07am UTC](https://meta.discourse.org/t/sso-authentication-issue-with-differently-cased-emails/67273/4 "2017-08-02T02:07:42Z")

</div>

> [@codinghorror](#):
>
> Make sure your code is case independent for many-to-one emails to users.

@LeoMcA added an unique index so we’re safe on this front.

> <https://github.com/discourse/discourse/blob/3538b63305582d53dabd1476170d99387fc4e97c/db/migrate/20170717084947_create_user_emails.rb#L15>

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [August 10, 2017, 3:06am UTC](https://meta.discourse.org/t/sso-authentication-issue-with-differently-cased-emails/67273/5 "2017-08-10T03:06:23Z")

</div>

@Martin_Cash There were some regressions we introduced when introducing multiple email address per user support. Usually all emails are downcased before being saved into the database but our code was incorrectly skipping validations. This should be resolved in

[https://github.com/discourse/discourse/commit/0bc690ed11182448e33e910f1a697dfbcace63b4](https://github.com/discourse/discourse/commit/0bc690ed11182448e33e910f1a697dfbcace63b4)

but do let me know if you run into this again.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 10, 2017, 3:54am UTC](https://meta.discourse.org/t/sso-authentication-issue-with-differently-cased-emails/67273/6 "2017-08-10T03:54:07Z")

</div>


