Fire SSO Login to discourse onLogIn on external site

סיכום מבוסס בינה מלאכותית

The user bvdrie72 encountered an issue where clicking a private message link from their external site (paddling.com) to Discourse (forums.paddling.com) only opens the forums without creating a message if the user is logged in to the external site but not the forums. The issue arises because SSO login isn’t triggered automatically. simon suggested using the SSO login link method from Create an SSO login link, which bvdrie72 confirmed worked successfully by appending the return_path to the SSO login URL, enabling automatic login and message creation.

We are using discourse with SSO and it works great.

However, I am running into an odd situation.

  • We are leveraging Discourse private messaging links on our external site (paddling.com) to spawn a new private message on discourse (forums.paddling.com).
  • If the user is logged in to the forums, it works exactly as expected.
  • If the user logs in to paddling.com (but doesn’t go to the forums first) when the user clicks on the link to spawn a new message, it simply opens the forums (without spawning a new message)
  • If the user clicks on the message link a second time, then the message works.

It seems to me that the issue is that while the user is logged in to paddling.com, they are not logged into the forums until they view a page on forums.paddling.com.

Here is an example classified ad so you can see the process:
https://paddling.com/classifieds/trak-2-0-for-sale-747840/

Is there a way to fire the SSO login (to forums.paddling.com) upon login on the external site (paddling.com)?

I found one reference that could work.:

You might be able to use the approach outlined here: Creating pre-filled personal message links. I haven’t tried using it with the return_path set to compose a prefilled PM, but I think it could be made to work.

The pre-filled personal message works fine (as long as the user is logged in). I will have our dev look at using the return_path

I just re-read my previous reply. What I had meant to write was that the approach outlined in this topic should work: Create an SSO login link. This is how our WordPress plugin creates links that automatically log users into Discourse. What I haven’t tested is using this approach with a pre-filled message URL set for the return_path.

Let me know if that still isn’t clear.

@simon thanks so much for the clarification. That makes more sense now. I will test it out and update here.

Quick update @simon - it worked perfectly.

https://forum.example.com/session/sso?return_path=https://forum.example.com/new-message?username=username%26title=title%26body=body+message

Thanks for your help.