The discussion revolves around changing the unique key to identify users in Discourse, particularly in the context of Single Sign-On (SSO). shahidmir seeks guidance on using a common ID across multiple apps to link user accounts. fefrei explains that SSO is the recommended solution, offering two approaches: either Discourse manages accounts and acts as the SSO provider, or Discourse uses an external app’s user database. The latter approach is preferred, as it allows passing the external app’s internal ID to Discourse. fefrei clarifies that if a user’s ID is not found, Discourse will use the email to identify the account, associate the external ID upon login, and then use the ID for future logins explained.
I am planning on migrating users over to discourse.
Which field in the db does discourse use to uniquely identify a user account?
I need to use a common id across multiple apps to link everything up so may need to change the unique key to that value…
If you follow that approach, you have two options:
Discourse can be managing user accounts. In this case, Discourse should be made the SSO provider. All other apps will have to use Discourse’s internal user id. (You should never attempt to modify the identifier of existing users, though.)
Discourse can use another app’s user database. In this case, the other app needs to implement the SSO protocol. In that case, you can just pass the id the external app uses internally to Discourse, and Discourse will remember it and use it to recognize the user later. (If the id is not found, Discourse will look at the email address.)
I’d recommend the latter approach because it’s a bit more flexible