You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/[platform]/deploy-and-host/sandbox-environments/seed/index.mdx
+65-1Lines changed: 65 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,71 @@ This will create a user with the username and password you provided and add them
126
126
127
127
The `getSecret` function will fetch the secret you have created using `npx ampx sandbox secret set`. This is useful when you have a public repository and don't want to commit secrets to the repository. Alternatively, you can set the username and password directly as a `string` in the `createAndSignUpUser` function but we recommend using secrets to avoid exposing sensitive information.
128
128
129
-
{/* MFA example */}
129
+
### Auth with TOTP MFA
130
+
131
+
For example, if you would like to seed your auth with a user with TOTP MFA enabled, lets start by configuring the auth resource:
132
+
133
+
```typescript title="amplify/auth/resource.ts"
134
+
import { defineAuth } from"@aws-amplify/backend";
135
+
136
+
exportconst auth =defineAuth({
137
+
loginWith: {
138
+
email: true,
139
+
},
140
+
141
+
multifactor: {
142
+
mode: "REQUIRED",
143
+
totp: true,
144
+
},
145
+
});
146
+
```
147
+
148
+
Now to create a user with TOTP MFA enabled, you can write the following script:
149
+
For this example, we will use the `otpauth` library to generate TOTP codes.
0 commit comments