How to seed local database with SSO user data

(Jay Pfaffman) #1

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.

(Rafael dos Santos Silva) #2

I have done exactly this.

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

(Jay Pfaffman) #3

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?

(Rafael dos Santos Silva) #4

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.

(Jay Pfaffman) #5

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.