A user, pfaffman, noticed that when login required is enabled and social logins are used, the desired URL is lost after logging in. Instead of being redirected to the original topic, users are taken to the home page. This issue is specific to social logins, as logging in directly with Discourse or using SSO (Single Sign-On) redirects users to the intended topic. pfaffman tested and confirmed that the issue persists even after rebuilding the site. codinghorror and simon joined the discussion, clarifying that SSO works properly with login-required forums and that the issue is specific to social logins.
What I would expect to happen (and what my client using auth0 wants to happen) is when you access a topic and are not logged in, you’d go straight tot the log in and be redirected to the topic after you’re logged in.
This seems similar to the problem of trying to access a protected topic when you’re not logged in. What happens in that case is you get a 404 and are then on your own to log in and try again to access that URL.
Would it be possible to when hitting a route that is protected to give the user an opportunity to log in before giving up?
Hey! I don’t remember seeing that before! And if I log in with Google, I’m redirected as I expect. This is different from the login required case that I started on, but accessing a locked URL when logged out is as close as I can come on meta and try.
I’ll rebuild on my site and see if this is a fixed regression.
Edit: OK. I did a rebuild on my login required site and it’s still the case that if I am logged out and visit a topic, if I log in with Google, I’m redirected to the home page, but if I log in with a Discourse username and password, I’m dumped at the home page rather than the topic page.
This works properly with SSO for login-required forums. The original link is passed as session[:destination_url] to /session/sso and then saved. It also works if you create an external SSO link with a return_path parameter: