Skip to content

Commit 8452767

Browse files
committed
add attributes and expects
1 parent 7358405 commit 8452767

File tree

1 file changed

+18
-3
lines changed
  • src/pages/[platform]/deploy-and-host/sandbox-environments/seed

1 file changed

+18
-3
lines changed

src/pages/[platform]/deploy-and-host/sandbox-environments/seed/index.mdx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ export const auth = defineAuth({
7979
loginWith: {
8080
email: true,
8181
},
82+
userAttributes: {
83+
locale: {
84+
required: false,
85+
mutable: true,
86+
},
87+
},
8288
groups: ["admin"],
8389
});
8490
```
@@ -99,6 +105,7 @@ import {
99105
getSecret,
100106
} from "@aws-amplify/seed";
101107
import { Amplify } from "aws-amplify";
108+
// @ts-expect-error this file will not exist until sandbox is created
102109
import outputs from "../../amplify_outputs.json";
103110

104111
Amplify.configure(outputs);
@@ -111,6 +118,9 @@ const user = await createAndSignUpUser({
111118
password: password,
112119
signInAfterCreation: false,
113120
signInFlow: "Password",
121+
userAttributes: {
122+
locale: "en",
123+
},
114124
});
115125

116126
await addToUserGroup(user, "admin");
@@ -157,10 +167,14 @@ import {
157167
import { Amplify } from "aws-amplify";
158168
import * as auth from "aws-amplify/auth";
159169
import * as otpauth from "otpauth";
170+
// @ts-expect-error this file will not exist until sandbox is created
160171
import outputs from "../../amplify_outputs.json";
172+
161173
Amplify.configure(outputs);
162-
const username = await getSecret("username1");
163-
const password = await getSecret("password1");
174+
175+
const username = await getSecret("username");
176+
const password = await getSecret("password");
177+
164178
const setUpTOTPAndChallenge = async (
165179
totpSetup: auth.SetUpTOTPOutput
166180
): Promise<ChallengeResponse> => {
@@ -228,6 +242,7 @@ import * as auth from "aws-amplify/auth";
228242
import type { Schema } from "./../data/resource";
229243

230244
import { generateClient } from "aws-amplify/api";
245+
// @ts-expect-error this file will not exist until sandbox is created
231246
import outputs from "../../amplify_outputs.json";
232247

233248
Amplify.configure(outputs);
@@ -289,8 +304,8 @@ Now to seed your storage with a picture, you can write the following script:
289304
import { getSecret, signInUser } from "@aws-amplify/seed";
290305
import { Amplify } from "aws-amplify";
291306
import * as auth from "aws-amplify/auth";
292-
293307
import * as storage from "aws-amplify/storage";
308+
// @ts-expect-error this file will not exist until sandbox is created
294309
import outputs from "../../amplify_outputs.json";
295310

296311
Amplify.configure(outputs);

0 commit comments

Comments
 (0)