Fire SSO Login to discourse onLogIn on external site

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: Compose a new pre-filled personal message via URL. 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.

1 Like

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.

1 Like

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

1 Like

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.

5 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.