# Configure sign up and log in with Auth0 using the OAuth2 Basic Plugin

**URL:** https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633
**Category:** Integrations
**Tags:** sso, oauth2, auth-plugins, how-to
**Created:** [6월 16, 2017, 8:45오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633 "2017-06-16T20:45:59Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![RCheesley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rcheesley/32/455409_2.png) [@RCheesley](https://meta.discourse.org/u/RCheesley)
#### Post date: [5월 29, 2018, 4:52오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/22 "2018-05-29T16:52:27Z")

</div>

> [@blake](#):
>
> Can you to into your Auth0 application settings and then “Advanced Settings” → “OAuth” and turn off “OIDC Conformant” and see if that helps?

Just tried that, saved changes and when I log in with Auth0, the user is created in Auth0 but fields are still not being populated. Thanks for the suggestion!

Ruth

---

<div class="post-metadata">

### Author: ![RCheesley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rcheesley/32/455409_2.png) [@RCheesley](https://meta.discourse.org/u/RCheesley)
#### Post date: [5월 29, 2018, 4:56오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/23 "2018-05-29T16:56:18Z")

</div>

> [@blake](#):
>
> I moved it to this topic to keep things in one place.

Seems like this thread seems to be deprecated, I never found it before, hence why the discussions were elsewhere! This would have saved me a lot of time so thanks for flagging it up!

---

<div class="post-metadata">

### Author: ![Serginho\_Cintra](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Serginho\_Cintra](https://meta.discourse.org/u/Serginho_Cintra)
#### Post date: [7월 18, 2018, 5:05오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/27 "2018-07-18T17:05:55Z")

</div>

Hi @blake,

I did all the steps but I having two kind of problems:

1. I can do the Auth0 authentication but it’s not copying user information to Discourse Dialog Window to create a new user. I have to write all the information on user creation.

2. If I create a new user as I told in step 1, it’s receiving the email and user of the last user that was created. It’s sounds very weird.

If you have a tip to fix it or if I am doing something wrong, please let me know.

Thanks, Sergio

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [7월 18, 2018, 8:51오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/28 "2018-07-18T20:51:48Z")

</div>

> [@Serginho\_Cintra](#):
>
> but it’s not copying user information to Discourse Dialog Window to create a new user.

This usually means something somewhere isn’t quite hooked up right. Can you verify these settings are correct in your auth0 settings?

> [@blake](#):
>
> Can you tell me what your settings are for your application under “Advanced Settings” → “OAuth”?

> [@blake](#):
>
> I think you may need to turn off “OIDC Conformant”.

Please provide any other settings you have configured in auth0 so I can help debug.

---

<div class="post-metadata">

### Author: ![Serginho\_Cintra](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Serginho\_Cintra](https://meta.discourse.org/u/Serginho_Cintra)
#### Post date: [7월 18, 2018, 10:27오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/29 "2018-07-18T22:27:33Z")

</div>

> [@blake](#):
>
> isn’t quite hooked up right

I looked now and “OIDC Conformant” is turned off.

---

<div class="post-metadata">

### Author: ![Serginho\_Cintra](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Serginho\_Cintra](https://meta.discourse.org/u/Serginho_Cintra)
#### Post date: [7월 18, 2018, 10:35오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/30 "2018-07-18T22:35:07Z")

</div>

My configuration:

 ![Auth0](https://global.discourse-cdn.com/meta/original/3X/8/1/81dfce99dc19a487e55972d397c157f19d09bbf3.png)

 ![Auth0-2](https://global.discourse-cdn.com/meta/original/3X/4/e/4e5dfbe0a3f1cef5ff057ea14f3e5499b035770c.png)

 ![Discourse](https://global.discourse-cdn.com/meta/original/3X/0/0/009cffbee22c3b12ac700226e38d4eb7c68eeaa6.png)

---

<div class="post-metadata">

### Author: ![Serginho\_Cintra](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Serginho\_Cintra](https://meta.discourse.org/u/Serginho_Cintra)
#### Post date: [7월 18, 2018, 10:36오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/31 "2018-07-18T22:36:17Z")

</div>

![Untitled](https://global.discourse-cdn.com/meta/original/3X/3/b/3be5bdce3b7c3d4425e38c36c6e099083d33165d.png)

---

<div class="post-metadata">

### Author: ![Serginho\_Cintra](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Serginho\_Cintra](https://meta.discourse.org/u/Serginho_Cintra)
#### Post date: [7월 18, 2018, 10:38오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/32 "2018-07-18T22:38:33Z")

</div>

All the new users are authenticated in Auth0 and at Auth0’s log everything is fine. But the information is not copied to create a new user in Discourse.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [7월 19, 2018, 4:16오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/33 "2018-07-19T16:16:22Z")

</div>

On the Discourse side can you remove “oauth2 json username path” , “oauth2 json name path”, and “oauth2 json avatar path” for now. Then can you update “oauth2 json email path” to “email”. Let’s see if we can just get that working, then we can work on the other fields.

Also you can check “oauth2 email verified” because auth0 is already verifying the email addresses.

---

<div class="post-metadata">

### Author: ![Serginho\_Cintra](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Serginho\_Cintra](https://meta.discourse.org/u/Serginho_Cintra)
#### Post date: [7월 19, 2018, 7:16오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/34 "2018-07-19T19:16:02Z")

</div>

Thanks for your return but unfortunately I am still stuck on it. I also create a new Auth0 account, just for text and the problem continuos. Is there a log where I can track this information?

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [7월 19, 2018, 9:11오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/35 "2018-07-19T21:11:31Z")

</div>

Have you been to `/logs` on your forum? If you have the debug oauth setting turned on your should be able to see some entries from auth0.

---

<div class="post-metadata">

### Author: ![Serginho\_Cintra](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Serginho\_Cintra](https://meta.discourse.org/u/Serginho_Cintra)
#### Post date: [7월 19, 2018, 11:31오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/36 "2018-07-19T23:31:38Z")

</div>

Yes, I tried to authenticate and I found 3 log entries:

![Log](https://global.discourse-cdn.com/meta/optimized/3X/9/8/9875f3f06d43d53ee316aa2c97aee8a38e66d182_2_690x49.png)

### Message

OAuth2 Debugging: after\_authenticate response:

`creds: {"token"=&gt;"42mopR4vXo5Tl-FzNxJn6S6umkL2W4Sh", "expires_at"=&gt;1532128992, "expires"=&gt;true} info: {"id"=&gt;nil, "name"=&gt;nil} extra: {}`

Message (6 copies reported)

`OAuth2 Debugging: user_json_url: GET https://xulapa.eu.auth0.com/userinfo`

Message (13 copies reported)

`OAuth2 Debugging: user_json: {"sub"=&gt;"google-oauth2|100582788655510862666"}`

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [7월 20, 2018, 1:54오전 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/37 "2018-07-20T01:54:34Z")

</div>

Auth0 should still send the user info whether you use google to auth or auth0 directly. But can you try and log in directly with auth0 username and pass instead of google and see what that sends to Discourse in the payload.

> [@blake](#):
>
> The json returned now looks something like this with an identities array:
> 
> ```plaintext
> {
> "email": "test@example.com",
> "user_id": "auth0|123456789",
> "identities":[{
> "user_id": "123456789",
> "provider": "auth0",
> "connection": "Username-Password-Authentication",
> "isSocial": false
> }]
> }
> 
> ```

Your json should look something like above.

I have this working at [https://discourse-test-prod-box.blakeerickson.com/](https://discourse-test-prod-box.blakeerickson.com/) you can also try google auth via auth0 and see if it works there.

---

<div class="post-metadata">

### Author: ![Serginho\_Cintra](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Serginho\_Cintra](https://meta.discourse.org/u/Serginho_Cintra)
#### Post date: [7월 20, 2018, 9:51오전 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/38 "2018-07-20T09:51:37Z")

</div>

I did two attemps. The first was by “Login” button and second with “Sign Up” button:

**Login**

`OAuth2 Debugging: after_authenticate response: creds: {"token"=&gt;"vqF7xblw0Ns6S4AP3YYR_TeMvw0IgopC", "expires_at"=&gt;1532166218, "expires"=&gt;true} info: {"id"=&gt;nil, "name"=&gt;nil} extra: {}`

`OAuth2 Debugging: user_json: {"sub"=&gt;"auth0|5b51aeca9a0b8834e8faa33f"}`

**Sign up**

`OAuth2 Debugging: after_authenticate response: creds: {"token"=&gt;"L0fY7Da7Sfh7lIra_C5QoCu2gc5aN1_0", "expires_at"=&gt;1532166327, "expires"=&gt;true} info: {"id"=&gt;nil, "name"=&gt;nil} extra: {}`

`OAuth2 Debugging: user_json_url: GET https://xulapa.eu.auth0.com/userinfo`

`OAuth2 Debugging: user_json: {}`

if you want I can send you my credentials because it’s just a prof of concept

---

<div class="post-metadata">

### Author: ![RCheesley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rcheesley/32/455409_2.png) [@RCheesley](https://meta.discourse.org/u/RCheesley)
#### Post date: [7월 26, 2018, 5:41오전 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/39 "2018-07-26T05:41:25Z")

</div>

Sounds like @Serginho_Cintra is having the same problem as me.

I’ve been working through this with Auth0 support having upgraded to a paid account, and everything is working fine from the Auth0 end. We are now seeing something very strange in that, any time anybody uses the Auth0 login they are being logged in as another user (the same user every time) who is in no way connected to the person logging in (but that user was the one previously created before the new user we are trying to create, as in Serginho’s case). That user is a forum administrator.

Happy to share Auth0’s debugging info if this helps get to the bottom of it.

To recap we were getting

- Auth0 user created successfully
- Information is _not_ populated through to the create user form
- User is being logged in as a forum administrator (the previously created user) now when they use Auth0 login/signup

Obviously a pretty critical issue! It’s basically blocking us launching our Discourse community for the past few weeks while we’ve been debugging.

Ruth

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [7월 26, 2018, 6:47오전 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/40 "2018-07-26T06:47:57Z")

</div>

auth0 uses Discourse. It would seem like this should be a well-documented solution. Maybe @jerdog has some ideas?

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [7월 26, 2018, 12:52오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/41 "2018-07-26T12:52:02Z")

</div>

> [@RCheesley](#):
>
> Sounds like @Serginho_Cintra is having the same problem as me.

Do you happend to have an EU based auth0 account?

The only thing Serginho and I were able to figure out was that Serginho had an EU based auth0 account, as soon as it was switched back to the US based auth0 account it worked fine. I’m not saying there isn’t some bug somewhere on the Discourse side, but something appears to be different on the auth0 side between their US and EU versions.

---

<div class="post-metadata">

### Author: ![jerdog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jerdog/32/122843_2.png) [@jerdog](https://meta.discourse.org/u/jerdog)
#### Post date: [7월 26, 2018, 12:59오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/42 "2018-07-26T12:59:17Z")

</div>

That doesn’t sound right at all - I am reaching out to one of our engineers to have a look, but it will probably be helpful if you could contact us through [our forum](https://community.auth0.com) so we can exchange the private tenant info needed to troubleshoot. We can then provide a summary back here of what was fixed.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [7월 26, 2018, 3:01오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/43 "2018-07-26T15:01:55Z")

</div>

> [@RCheesley](#):
>
> - Information is _not_ populated through to the create user form
> - User is being logged in as a forum administrator (the previously created user) now when they use Auth0 login/signup

From previous debugging, auth0 is sending an empty payload (or near empty) which is why the form isn’t being auto-populated. But what I think is happening is Discourse is inserting an empty value in the db as the unique id. So any user who then signs in again will authenticate against that empty value. Obviously there is some improvement to be made on the discourse side to make sure THAT doesn’t happen, but the root cause is auth0 isn’t sending a populated payload for some reason.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [7월 26, 2018, 4:23오후 UTC](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633/44 "2018-07-26T16:23:42Z")

</div>

> [@jerdog](#):
>
> I am reaching out to one of our engineers to have a look,

Awesome thanks!

> [@jerdog](#):
>
> it will probably be helpful if you could contact us through [our forum](https://community.auth0.com) so we can exchange the private tenant info needed to troubleshoot.

Just made a topic on your forum 🙂

> **[Possible oauth2 problem with Discourse and Auth0 EU sites](https://community.auth0.com/t/possible-oauth2-problem-with-discourse-and-auth0-eu-sites/13681)**
>
> Hi Auth0 Team, I’m a developer for Discourse and the author of this how-to guide: We currently have two Discourse users both using EU Auth0 accounts that are experiencing the exact same issue and I can replicate it with my own EU Auth0 account...

[이전 페이지](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633.md?page=1)

[다음 페이지](https://meta.discourse.org/t/configure-sign-up-and-log-in-with-auth0-using-the-oauth2-basic-plugin/64633.md?page=3)
