Skip to content

Instantly share code, notes, and snippets.

@koistya
Created December 18, 2024 18:58
Show Gist options
  • Save koistya/a336afeb5e793b6674da1c7511bb65dd to your computer and use it in GitHub Desktop.
Save koistya/a336afeb5e793b6674da1c7511bb65dd to your computer and use it in GitHub Desktop.
Migrate Firebase auth users from one GCP project to another
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