A user, Jean-Michel25, seeks help on integrating Discourse SSO with their PHP/MySQL website, where users log in via Discourse (forum.mysite.com) and the main site (www.mysite.com) needs to recognize their login status, username, and group. vinothkannans explains that Discourse has built-in SSO provider functionality and directs to the official guide. The user asks about the SSO flow: clicking a link on the external site triggers Discourse to return user data, which the external site then uses to start a session. vinothkannans confirms this and clarifies that set_key() is a placeholder for creating a session. Jean-Michel25 asks about get_key() and set_key(), specifically whether the nonce should be stored in a database or session. vinothkannans and simon confirm the nonce can be stored temporarily, either in a database or session. Jean-Michel25 confirms that using session variables for the nonce works well and thanks the community.
Many time to read topics, but I cannot undestand how to do.
Maybe you can help me ?
We installed a Discourse forum on OVH VPS, subdomain of our site (forum.mysite.com)
Old users will be imported into Discourse Forum.
New users will create account by Discourse Forum.
All users will sign on with Discourse.
OK
Our main site (www.mysite.com) is PHP/MySQL.
My php pages have to know if the user is logged, his username, his group.
How to do ?
I can create PHP scripts, but I don’t know Ruby.
I see it’s the solution, but I don’t andertand howto use.
The way with this script :
1/ On external site, user click the link <a href='$discourse_url/session/sso_provider?$query'>sign in with discourse</a>
2/ Discourse returns user info
3/ external site open a session ?
I’m ok or not ?
I’m not far, but have not yet all keys…
Migration stopped until I anderstand how to use the script…
Many thanks !
Last question please about get_key() and set_key() functions
// pretend that set_key is a function that saves key value data in a database
Initially we store the nonce in a database (a single column table ?)
When Discourse respond, we just check if nonce exists in the table ?
If yes, we store login infos received from Discourse with the $_GET
(then store in PHP session…)
I misread what is being done here. To use Discourse as the SSO provider, the nonce will have to be stored somewhere on the website. The wp-discourse plugin does it by saving the value to the database.