How to seed local database with SSO user data

AI-generated summary

The discussion revolves around seeding a local database with SSO user data, particularly avatars. pfaffman initially tried using client.sync_sso, but it pushes instead of pulls SSO data. Falco shared their experience of creating users using the API and suggested doing so during the import process.

Falco recommended creating users during the import and setting their avatars at the same time, requiring a dump with avatar URLs. pfaffman found that they can pass an avatar_url to create_users, solving their problem.

I’ve got a client that I’m doing an import for. They’re using SSO, which will supply avatars, but of course those get populated only when someone logs in. I noticed client.sync_sso and it appears to do just what I need. I think I’d like to do this from the API, but rails console would be fine too.

I thought that client.sync_sso would work, but it appears to push SSO data, not pull SSO data.

Is there some way that I can suck down the SSO data for each user? It doesn’t look like the API will help, maybe something in the console? Looks like lookup_or_create_user might help, but I can’t find the external_id.

I have done exactly this.

What I did was getting the user database, and created all the users using the API.

That sounds like what I’m looking for @Falco. Are you saying that I should create all the users from the API before I run the import script that creates the users, or that I should somehow use an API call in the import script to create the user?

Can you point me to some code?

I would create the users during the import, and set the avatar at import time also.

You need to ask for a dump that also contains avatars urls.

I believe I have the URLs. Since avatars get populated when someone logs in, I was thinking that I could use the API (or console) to suck them down from SSO. The importers I’d looked at were uploading the avatars (which I don’t have), but now I see that I can pass a avatar_url to create_users, which should solve my problem.

Thanks.