Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate users #463

Open
KhaledAld opened this issue Oct 8, 2018 · 1 comment
Open

migrate users #463

KhaledAld opened this issue Oct 8, 2018 · 1 comment

Comments

@KhaledAld
Copy link

Hi

how to make migrate users from my server to skygear database.

can I use cloud function to create API to add my users to a skygear server?

Thanks.

@carmenlau
Copy link
Contributor

@KhaledAld Have you solved the problem yet? You mentioned your problem in #359

To migrate users from your server to skygear, you don't need to do it in cloud function. There are several ways to do it.

  1. The simplest way, you can create a node script and import skygear js sdk. In the node script, fetch your server users data, generate JWT token and call loginWithCustomToken. But this way will have a problem that all users created_at and last_login_at will be the same (the time that you run the script.) If those information is important to you and you need to migrate them, you can consider method 2.

  2. Understand the user models in skygear postgresql db, migrate data to db directly. By using this way, you can fully control the data. When signing up a user, there will have 3 entries inserted into the db. They are user, _auth and _sso_custom_token. user._id, auth.id and _sso_custom_token.user_id should be same uuid for each user. _sso_custom_token.principal_id is the sub of JWT token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants