Using Discourse as a SSO on a headless WP install

AI-generated summary

Using Discourse as a SSO on a Headless WP Install

Lucas_Meijer wants to use Discourse as a Single Sign-On (SSO) provider for a headless WordPress installation to avoid users having multiple accounts. He aims to sync users into WordPress, allowing authentication to be handled through WP while still authenticating users into both Discourse and WP.

simon suggests that it is possible to achieve this, as the Discourse plugin redirects users to a URL (http://example.com?discourse_sso=1&redirect_to=http://example.com/your-landing-page) when logging in through Discourse SSO. He encourages Lucas_Meijer to try it out and report any issues.

Lucas_Meijer appreciates the feedback but notes that the authentication aspect is currently out of scope for the project. However, he may revisit it in a future project and will reach out if any issues arise.

Hey! I’d love to use Discourse as a SSO on a headless WP installation. Is it possible with the current WP discourse plugin? I’d like to use it for auth in WP so I can build functionality in WP, while avoiding for the users to have more than one account, and Discourse has the best user management of the two :slight_smile:

Any ideas on how to implement this? What would be ideal is if all the users could be synchronized into Wordpress somehow, so that all authentication can be handled through WP but they will still be authenticated into both Discourse and WP. That way I can handle the authentication on the front end of the headless app…

When users are logged into WordPress with Discourse as the SSO provider, the login process begins by redirecting the user to

http://example.com?discourse_sso=1&redirect_to=http://example.com/your-landing-page.

It should be possible to get this to work with a headless WordPress site. Let us know if ou run into any problems with it.

Thank you! Realized that the auth aspect of the site was out of scope for this project, but if I ever implement it in a future project I’ll get back if I run into issues :slight_smile: