Adding an external id to an user instance

(Keith John Hutchison) #1

I’m studying importing posts into a discourse forum and discovered that there is an API call to find users by external id.


I’m using ruby to do the importing and the user model has no external id attribute that I can see.

How do you set an external id for a user with ruby code?

(Rafael dos Santos Silva) #2

The external_id is supposed to be used when using SSO.

If you won’t use SSO and just want to store a per user ID from the old system, use a custom user field for that.

(Jay Pfaffman) #4

All of the importers store the user ID in a user custom field with name import_id. If you are using any existing importer as a model then you should have the external ID available.

(Keith John Hutchison) #5

I ran

grep -r "import_id" .

in a discourse source folder to get an overview and to find examples.

Thanks Jay!