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

@sirideain @Max_Colvin I’m really sorry that I’m only now addressing this, but sometime since my original post (Jun '17) and Oct '17 Auth0 made some changes to their dashboard and to the json schema that is returned.

I just pushed a fix to address this:

https://github.com/discourse/discourse-oauth2-basic/commit/bce6e9e878c4e3843f8ba8473778cc4b0595144f

The json returned now looks something like this with an identities array:

{
        "email": "test@example.com",
        "user_id": "auth0|123456789",
        "identities":[{
                "user_id": "123456789",
                "provider": "auth0",
                "connection": "Username-Password-Authentication",
                "isSocial": false
        }]
}

The problem is that we can’t key off of the root user_id because it contains the authentication provider before the <auth-provider>|<user_id>, and it could be auth0, twitter, facebook, etc depending on which one the user signed-up/logged-in with, but it needs to be unique which is why we are now grabbing the user_id contained inside of the identities array.

So now inside of your discourse site settings you can configure oauth2_json_user_id_path to be identities.[].user_id

Also inside of the Auth0 dashboard when you setup a new application be sure that “Use Auth0 instead of the IdP to do Single Sign On” is turned off:

because it is now on by default, but should be off for doing oauth.

4 Likes