You will have to save the user external_id
in custom field when creating SSO record. See example here:
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.