(Retired) Use an ID in a custom user field to link to a user's external profile

You will have to save the user external_id in custom field when creating SSO record. See example here:

https://github.com/discourse/discourse/blob/a3b2b4bacac92b0dc5ceaf6892f782f4b5584a57/spec/controllers/session_controller_spec.rb#L52-L57

Or you can fill the custom user field via sync_sso method. For example:

client.sync_sso(
  sso_secret: "discourse_sso_secret",
  name: "Test Name",
  username: "test_name",
  email: "name@example.com",
  external_id: "2"
  custom.user_profile_id: "2"
)

Relevant code here.

3 Likes