You are not understanding what I want to convey. I’m not asking about retrieving user details from Discourse after login. Please understand the complete flow of what I’m trying to achieve, and let me know if it’s possible with Discourse or if I should proceed with my own approach.
Currently, I have a project built using the Laravel framework, and I want to provide users with access to the Discourse forum for feedback. I’ve decided to implement SSO login for Discourse. I created a Discourse admin account and enabled the necessary settings for SSO login, including enabling SSO, setting the redirect URL, and configuring the secret.
Now, I’ve added a ‘Discourse Connect’ button inside my project. I want when users click on this button, register or log in using my credentials, and automatically log in to Discourse. When users click on the ‘Discourse Connect’ button, i am redirects them to my base community URL with the session/sso endpoint, which then redirects back to my Discourse Connect URL. I receive the SSO and sig parameters in the request, which I understand are for validation. However, I need the user_id or some identifier to retrieve user data from my database to validate, authenticate, and log the user into Discourse.
My question is: Is there an API or some mechanism in Discourse that can return the user_id along with the SSO and sig parameters in the request? This is important because, without retrieving user data in the request, I would have to make the user log in again, which would provide a poor user experience. Essentially, when a user logs into my project and clicks the ‘Discourse Connect’ button, the Discourse Connect URL is triggered, and I receive the SSO and sig parameters. To authenticate the user, I need to fetch user data from the database, but this would require the user to log in again, which I want to avoid.
I want a seamless experience where, if the user is already logged in once, they don’t need to log in again. They should be able to access the Discourse forum using their project credentials directly.