Ensure that user is signed in to Discourse

Our discource is set to use SSO from our businesses app.
In few business process we use discourse as email and notification relay.
Some business flow starting at our erp with forms and moving on discource.
Since discource crating SSO users only when they loged in discource, we have cases that users exists in our erp, but they do not exists in discoure.
It happens if they did not sing in discource ever.
If my users does not exists in discource the work flow fails.
User is not going to be notified by email or desktop notification.
Our app can check does user exist in discource by finding user by external-id.
But I do not have an idea how to push user to sing in to discource and send him back to initial form, if app realize that user does not exist in discourse.

Is there some discource endpoint that will after singing in redirect user to parametered url ?

I want to send user to singing in discource and get back to my form ?

2 Likes

You can use the API to force the user to be crested when the account is created in SSO. The Wordpress plugin did this, so you might look the for an exempt.

Yes calling #sync_sso endpoint with the full single sign on payload can allow you to pre-stage accounts.

3 Likes

Hi
I find myself in the same situation.
I will be migrating users to discourse. Until they login via the SSO, there will be no record in the single_sigon_records.

If any one of my users changes his email in the main app, before attempting an SSO into discourse, then the next time he comes to discourse will be with a new email address, which will fail.

I do not want to use a pre-staging strategy as some of those users may never even login to discourse, hence want to avoid creating records for no reason.

But if i have to go down this route, could I insert data into the ‘single_sigon_records’ table manually, or would it have to be via the sso_sync endpoint?
I notice the table has a ‘last_payload’ field, which could be problematic in this case?

regards
shahid