Is it required to import users when using SSO?

AI-generated summary

In a discussion about migrating from Vanilla to Discourse with SSO enabled, kodab asks whether importing users is mandatory or if they can be created on-the-fly via SSO. vinothkannans initially states that importing users is necessary because posts require owners, and SSO can be enabled afterward without issue. pfaffman clarifies that new users authenticated via SSO will automatically get Discourse accounts, and while some importers may support password imports, it’s irrelevant with SSO since authentication is handled externally. kodab confirms the Vanilla import script doesn’t import passwords and seeks best practices. pfaffman explains that skipping user import is technically possible — posts would then be owned by the system user — but questions the rationale. kodab appreciates the clarification, confirming the behavior he was curious about. The consensus is that while user import is not strictly required, omitting it may result in orphaned posts assigned to the system user, and importing users first remains the standard, recommended approach.

I’m currently using the import script provided by discourse to transfer my old vanilla forum tdiscrouse. After the import is done, I want to enable SSO and use my Laravel PHP website framework as my main user database.

Q: is it required to import all users in discourse with the import script or are they imported into discourse when they login for the first time in discourse? What about the threads that I import that are assigned to userID? If I don’t import users, how is it possible to import content and match it against users?

By default all the import scripts will import users too. And it is necessary too.

You can enable SSO after that. It will not affect in most of the time.

Thanks Vinoth, I knew that already. What happens if I don’t import the users and enable SSO? Also the import script is not importing passwords right? How is that done?

I guess it can’t be done in this way. Since all posts must have their post owner while importing you can’t skip it completely.

I am not sure but I think few import scripts will import passwords too. Read Vanilla migration’s how-to topic.

If you use SSO new users who get authenticated will get new accounts in Discourse.

It is possible to import passwords with if you use a plugin that supports importing passwords (look in #plugins). Importing passwords is moot, though, if you’re using SSO, since it will be doing the authentication.

I guess it can’t be done in this way. Since all posts must have their post owner while importing you can’t skip it completely.

I am not sure but I think few import scripts will import passwords too. Read Vanilla migration’s how-to topic.

Thanks for your reply. I studied the source code and I’m sure the vanilla mysql script does not import the passwords since it does not select the password column from the vanilla database.

I’m still seeking the answer for my questions, thanks for trying to help. :slight_smile:

Can you please explain why you don’t like to import old users. If you enable SSO after importing Vanilla it will still work in your case.

It’s not that I don’t like importing old users but I’m asking myself if it’s necessary. :slight_smile: I’m trying to find out the best approach to do this and what is the best practice.

Thanks Jay, I appreciate your answer.

So if I understand it right, new users get accounts in discourse when they authenticate right? So if I don’t import users.. is it still possible to import forum data like threads and posts or is it required to have the users in the discourse user database?

I can imagine discourse can query the laravel user database if it needs info on a user with SSO so importing users maybe can be done on-the-fly so if a users logs in to discourse, the account gets created.

I do not understand why you would not want to import users. Why would you not want to?

But yes, you can comment out the import_users function of the importer script. If you do that, all imported posts will be owned by he system user. (At least that’s what would happen in most import scripts.)

Thanks Jay that was the info that I was looking for! :slight_smile: I was curious about the behaviour when I would not import the users in discourse and you answered that. Thanks!!