Unable to create user in Discourse from WP with new registration form

To be honest I’m a little confused as to how this description of your issue relates to your previous description of an issue being caused by having two different Wordpress registration forms. But I think I can help you here nonetheless.

One thing to understand is that there is no way (and has never been a way) to be instantly logged in to two different services on two different domains. Whenever it seems like you’re logged into service A on domain A and when you go to service B on domain B you’re also logged in what has actually happened is you’ve been logged in to service B via service A only once you visit domain B and a login process is initiated, not before.

Another thing to understand is that, outside of the specific scenario you’re describing where you want to redirect a person to a specific place in the app which requires a session, most users do not care about, or notice the fact that they need to click “login” on service B sometimes. In my experience working with clients on identity solutions site administrators are typically much more sensitive to this than their users are.

The way this works hasn’t changed. Whenever it seems like a user is “automatically” logged in what actually is happening is they’ve been redirected back to Wordpress and then redirected back to Discourse once their session in Wordpress has been authenticated. If they’re already logged in in Wordpress it will seem like they’ve been “automatically” logged in to Discourse as this redirection will happen without the user needing to do anything.

One way you can trigger the “automatic” login, and redirect them to a specific place in Discourse after login, is by using the path you’ve already shared

https://community.showprowess.com/session/sso?return_path=[any path in Discourse]

If the user is already logged in to Wordpress, but not yet logged in to Discourse when using this URL, this is what will happen:

  1. Discourse automatically starts the DiscourseConnect login process
  2. User’s browser is redirected to wordpress
  3. User is already logged in, so the user is automatically redirected back to Discourse
  4. If there was a return_path value in the URL used in 1 the user will be redirected there

From the user’s perspective they will see their browser loading briefly, but they will effectively be “automatically” logged in to Discourse and redirected to a specific part of the app.

Note that you can actually make the return_path any URL, even a separate domain, if you set the site setting discourse connect allows all return paths to true.

2 Likes