Created
December 18, 2024 18:58
-
-
Save koistya/a336afeb5e793b6674da1c7511bb65dd to your computer and use it in GitHub Desktop.
Migrate Firebase auth users from one GCP project to another
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { identitytoolkit } from "@googleapis/identitytoolkit"; | |
const { relyingparty } = identitytoolkit({ | |
version: "v3", | |
}); | |
let nextPageToken = undefined; | |
do { | |
const res = await relyingparty.downloadAccount({ | |
requestBody: { | |
targetProjectId: "project-id", | |
nextPageToken, | |
}, | |
}); | |
nextPageToken = res.data.nextPageToken; | |
await relyingparty.uploadAccount({ | |
requestBody: { | |
targetProjectId: "project-id", | |
users: res.data.users, | |
} | |
}) | |
} while (nextPageToken); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment