# OAuth Email missing in data explorer

**URL:** https://meta.discourse.org/t/oauth-email-missing-in-data-explorer/67766
**Category:** Support
**Created:** [August 10, 2017, 9:02am UTC](https://meta.discourse.org/t/oauth-email-missing-in-data-explorer/67766 "2017-08-10T09:02:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Bas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bas/32/294929_2.png) [@Bas](https://meta.discourse.org/u/Bas)
#### Post date: [August 10, 2017, 9:02am UTC](https://meta.discourse.org/t/oauth-email-missing-in-data-explorer/67766/1 "2017-08-10T09:02:21Z")

</div>

Using this query:

```sql
SELECT id, username, email
FROM users

```

The following is returned

 ![pixelized](https://global.discourse-cdn.com/meta/original/3X/a/8/a86184687256993c2db11f5d122d6d2e03504ce0.png)

All those `NULL` results are people who have signed up using Google OAuth2

The emails are in the system correctly, I can see them in their profiles.

What am I doing wrong? 🙂

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [August 10, 2017, 9:16am UTC](https://meta.discourse.org/t/oauth-email-missing-in-data-explorer/67766/2 "2017-08-10T09:16:58Z")

</div>

We no longer use the `email` column on the `users` table.

You need to join the `users` table with the `user_emails` table with the `primary = true` condition 😉

---

<div class="post-metadata">

### Author: ![Bas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bas/32/294929_2.png) [@Bas](https://meta.discourse.org/u/Bas)
#### Post date: [August 10, 2017, 9:29am UTC](https://meta.discourse.org/t/oauth-email-missing-in-data-explorer/67766/3 "2017-08-10T09:29:35Z")

</div>

```sql
SELECT u.id, u.username, u.email, ue.email
FROM users u
INNER JOIN user_emails ue ON u.id = ue.id
WHERE ue.primary = true

```

That worked 🙂

I was thrown off by the one email that was there; but I guess that’s a remnant of running

```bash
cd /var/discourse
./launcher enter app
rake admin:create

```

when I was [troubleshooting](https://meta.discourse.org/t/troubleshooting-email-on-a-new-discourse-install/16326/2) my email troubles.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [August 10, 2017, 9:30am UTC](https://meta.discourse.org/t/oauth-email-missing-in-data-explorer/67766/4 "2017-08-10T09:30:36Z")

</div>

The column is in readonly mode. We’ll completely remove it when we’re 100% it’s safe to do so.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:44pm UTC](https://meta.discourse.org/t/oauth-email-missing-in-data-explorer/67766/5 "2024-06-08T12:44:22Z")

</div>

This topic was automatically closed after 2494 days. New replies are no longer allowed.
