They click Get help on the community forum, and are taken to Auth0 to sign in
After signing in, they are redirected to discourse.getdbt.com but with the CSRF warning displayed.
If they click Log In and then Use your dbt Community Account, the account is successfully created and they see the account creation dialog where they can set their username etc.
Loom video showing this in action:
I have enabled oauth2 debug auth and in the logs can see (oauth2_basic) Authentication failure! csrf_detected: OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected
My questions:
Is this a Discourse issue or an Auth0 issue? I assume Discourse since a basically identical login flow for Slack works without issue.
Why does this work on the Login page but not when login is triggered from the Auth0 side?
The default CSRF error message implies that it happens when the browser changes, or when the login flow takes too long. Neither of those are the case, what else could be causing it?
Should I put https://discourse.getdbt.com/auth/oauth2_basic in the Application Login URI field and leave https://discourse.getdbt.com/auth/oauth2_basic/callback in the Allowed Callback URLs field?
Can you share some more detail about how the āGet help on the Community Forumā link is implemented? Where does the link go? I am currently assuming that the button is handled by Auth0, and that adding that new URL configuration will cause the button to correctly link to /auth/oauth2_basic to start the login flow.
Sorry for the slow reply - just getting back after the Christmas break!
I did this:
but still get the same result.
That link points to https://dev-zb38hsho.us.auth0.com/samlp/5GpVvVgryMnBaNJFuLt5DW3bs89jO0hr, where dev-zb38hsho is our Auth0 instance ID and 5GpVvVgryMnBaNJFuLt5DW3bs89jO0hr is the Client ID for the Discourse Application in Auth0.
Visiting that link redirects to https://dev-zb38hsho.us.auth0.com/u/login?state=SESSION_SPECIFIC_TOKEN.
The key is that Discourse needs to start the authentication flow at /auth/oauth2_basic, then redirect to Auth0, then come back to /auth/oauth2_basic/callback.
I was hoping we could get Auth0 to trigger login by starting with the first URL, but it sounds like itās jumping Discourse straight to the callback URL.
Could you update the button to point to /auth/oauth2_basic on the forum? That will start the authentication flow and immediately redirect to Auth0, so the overall UX should be the same.
Yes that works! It does pause on an interstitial page with a Continue button; is user interaction mandatory to safely trigger an OAuth flow or something?
That page is shown when there are multiple login methods on a site. If you disable ālocal loginsā (username/password) then it should go straight through to the login process.