We use the official Discourse sso and pass a set of groups via add_groups/remove_groups. However now we’re looking for a good way to “refresh” the list of groups. Can anyone think of a way to do this without having the user have to logout/login?
AI-generated summary
In a discussion about refreshing SSO groups in Discourse, carlokok asks for a way to update group assignments without requiring users to log out and back in. sam replies that the sync_sso route can be used to update SSO data—including groups—without logging the user out, and explains that a third-party app can trigger this at its discretion, such as when a user’s profile picture is updated on the master site. pfaffman asks when or how this would happen, and sam clarifies it’s up to the external app to invoke it, perhaps via a background job. lkramer requests example code for using sync_sso, to which pfaffman responds that no code is immediately available but suggests starting a new topic with details about the membership system and goal; they also mention that the wp-discourse plugin has improved and may simplify the process. Finally, simon provides a helpful link to the official documentation: Sync SSO user data with the sync_sso route. The thread highlights that sync_sso is the correct and supported method for refreshing SSO data dynamically, with implementation depending on the external system’s architecture.
Yeah … you would use the sync_sso route, you just pass it the sso payload and it updates all the data without logging the user out.
When/how would that happen?
3rd party app would run it at its discretion.
For example … master user account updates profile picture on master site … call sync_sso to pass it to Discourse in a background job.
Hi Jay. Have you successfully used sync_sso? If so, would you mind sharing some example code?
I’ve got nothing at hand. If you want help here, start a new topic, say what membership stuff you’re using and what you’re trying to accomplish. I think you just need a few lines in whatever membership thing you’re using to push the stuff over.
Lots of stuff has gotten better in the wp-discourse plugin which might solve your problem pretty easily.
You can find details about using the sync_sso route to refresh sso data here: Sync SSO user data with the sync_sso route