-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
Copy path01-users.ts
87 lines (84 loc) · 2.8 KB
/
01-users.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* SPDX-FileCopyrightText: 2014-present Kriasoft */
/* SPDX-License-Identifier: MIT */
import {
AuthPlus,
identitytoolkit,
identitytoolkit_v3,
} from "@googleapis/identitytoolkit";
/**
* Test user accounts generated by https://randomuser.me/.
*/
export const testUsers: identitytoolkit_v3.Schema$UserInfo[] = [
{
localId: "test-erika",
screenName: "erika",
email: "[email protected]",
emailVerified: true,
phoneNumber: "+14788078434",
displayName: "Erika Pearson",
photoUrl: "https://randomuser.me/api/portraits/women/29.jpg",
rawPassword: "paloma",
createdAt: new Date("2024-01-01T12:00:00Z").getTime().toString(),
lastLoginAt: new Date("2024-01-01T12:00:00Z").getTime().toString(),
},
{
localId: "test-ryan",
screenName: "ryan",
email: "[email protected]",
emailVerified: true,
phoneNumber: "+16814758216",
displayName: "Ryan Hunt",
photoUrl: "https://randomuser.me/api/portraits/men/20.jpg",
rawPassword: "baggins",
createdAt: new Date("2024-01-02T12:00:00Z").getTime().toString(),
lastLoginAt: new Date("2024-01-02T12:00:00Z").getTime().toString(),
},
{
localId: "test-marian",
screenName: "marian",
email: "[email protected]",
emailVerified: true,
phoneNumber: "+19243007975",
displayName: "Marian Stone",
photoUrl: "https://randomuser.me/api/portraits/women/2.jpg",
rawPassword: "winter1",
createdAt: new Date("2024-01-03T12:00:00Z").getTime().toString(),
lastLoginAt: new Date("2024-01-03T12:00:00Z").getTime().toString(),
},
{
localId: "test-kurt",
screenName: "kurt",
email: "[email protected]",
emailVerified: true,
phoneNumber: "+19243007975",
displayName: "Kurt Howard",
photoUrl: "https://randomuser.me/api/portraits/men/23.jpg",
rawPassword: "mayday",
createdAt: new Date("2024-01-04T12:00:00Z").getTime().toString(),
lastLoginAt: new Date("2024-01-04T12:00:00Z").getTime().toString(),
},
{
localId: "test-dan",
screenName: "dan",
email: "[email protected]",
emailVerified: true,
phoneNumber: "+12046748092",
displayName: "Dan Day",
photoUrl: "https://randomuser.me/api/portraits/men/65.jpg",
rawPassword: "teresa",
createdAt: new Date("2024-01-05T12:00:00Z").getTime().toString(),
lastLoginAt: new Date("2024-01-05T12:00:00Z").getTime().toString(),
customAttributes: JSON.stringify({ admin: true }),
},
];
/**
* Seeds the Google Identity Platform (Firebase Auth) with test user accounts.
*
* @see https://randomuser.me/
* @see https://cloud.google.com/identity-platform
*/
export async function seed() {
const auth = new AuthPlus();
const { relyingparty } = identitytoolkit({ version: "v3", auth });
await relyingparty.uploadAccount({ requestBody: { users: testUsers } });
}