Auth configuration
The settings for Amplify backend auth are the auth object in the backend block of amplify.jsonc. aws amplifygen3 local run applies them to the local backend. Each deployment sends them to the environment’s backend. This page lists every setting, in groups: app name, trusted origins, email and password, email verification, social providers, plugins, user, session, account, rate limit, advanced (cookies), and platform (your SMTP server and the managed sign-in page). Every sign-in method other than email and password is off until you turn it on. After the settings, the page covers per-environment settings, secrets and how to check the settings that an environment runs with.
The auth block
aws amplifygen3 local run and a new environment use the default settings when amplify.jsonc has no auth block, or has "auth": {}: email and password sign-in on, and App as the app name. A deployment with no auth block uses the settings stored with aws amplifygen3 env edit, if any. Otherwise the environment keeps the settings that it runs with.
An auth block that you write replaces the defaults whole. Keep "emailAndPassword": { "enabled": true } in every block, and set appName. A setting that you leave out still gets its own default, such as 8 for minPasswordLength.
{ "backend": { "auth": { "appName": "Acme Notes", "emailAndPassword": { "enabled": true, "minPasswordLength": 12 }, "session": { "expiresIn": 86400 } // seconds } } }
Run aws amplifygen3 local run again after you edit the block, and then deploy. Running local run again keeps your local data. Both commands check the root backend.auth block first, and stop with an error on any key that isn’t listed on this page, such as a misspelled key. aws amplifygen3 deploy doesn’t check an env.<name>.backend.auth block, and a problem in that block fails the deployment with CONFIG_RETRIEVAL_FAILED. For how the local backend applies these settings, see Local auth and emails.
You can write // and /* */ comments in amplify.jsonc. aws amplifygen3 local run refuses a file with a trailing comma anywhere in it.
App name
appName is the name your users see: on the managed sign-in page, in auth emails and as a passkey’s site name.
| Setting | Values | Default |
|---|---|---|
|
|
3 to 64 printable ASCII characters, with no |
|
aws amplifygen3 local run, aws amplifygen3 deploy and aws amplifygen3 env edit warn when backend.auth has settings but no appName.
Trusted origins
A deployed backend accepts calls from its own origin and from these origins: the Amplify console, the environment’s URL, its custom domains and the URLs of its recent successful deployments, up to 100 hosts in all. trustedOrigins adds other origins, such as a dev server that you start yourself, a site hosted elsewhere or a mobile app’s scheme.
"trustedOrigins": ["http://localhost:5173", "https://admin.example.com", "myapp://callback"]
Each browser call to /auth must come from a trusted origin. Each callbackURL, redirectTo and redirectUri that you pass must be on a trusted origin too.
-
Each entry needs a scheme. The list holds up to 100 entries of up to 512 characters.
-
"*"is refused. -
A mobile deep link entry, such as
myapp://callback, also matches the paths below it. A baremyapp://is refused. -
https://*.example.comtrusts every subdomain of a domain that you own. -
In token mode, the default for a deployed app, the backend sends the user back after a redirect sign-in, such as on the managed sign-in page, only to an origin that matches an entry exactly.
-
A deployment fails with
CONFIG_RETRIEVAL_FAILEDwhentrustedOriginsorpasskey.originshas a wildcard over hosts that others own, such ashttps://*.vercel.app,https://*.amplify.app,https://*.com, a public suffix such ashttps://*.co.uk, an IP address or the backend’s own domain. List each of those origins exactly. For one Amplify app,https://*--<app-id>.amplify.appis allowed. -
A deployed backend doesn’t accept calls from another environment’s site. The local backend accepts calls from the dev server that
aws amplifygen3 local runstarts.
Email and password
emailAndPassword turns email and password sign-in on and sets its rules. For the sign-up, sign-in and reset calls, see Email and password.
| Setting | Values | Default |
|---|---|---|
|
|
Boolean |
|
|
|
Boolean |
|
|
|
6 to 20, and no more than |
|
|
|
8 to 128 |
|
|
|
300 to 86400 |
|
|
|
Boolean |
|
|
|
Boolean |
|
Email verification
emailVerification sets when the backend sends a verification link.
| Setting | Values | Default |
|---|---|---|
|
|
Boolean |
The value of |
|
|
Boolean. |
|
|
|
300 to 86400 |
|
When emailAndPassword.enabled and requireEmailVerification are both true, at least one of sendOnSignUp and sendOnSignIn must be true.
Social providers
Each provider block in socialProviders adds that sign-in option. The providers are apple, cognito, discord, facebook, github, google, linkedin, microsoft, slack, spotify and twitter (X). For setup, see Social sign-in and OAuth.
"socialProviders": { "google": { "clientId": "123-abc.apps.googleusercontent.com", // required, 1 to 256 characters "clientSecret": "${env:GOOGLE_CLIENT_SECRET}" // required, an ${env:NAME} reference } }
| Setting | Values | Default |
|---|---|---|
|
|
1 to 256 characters |
None |
|
|
1 to 128 characters |
|
|
|
Required |
None |
Plugins
Each plugin in plugins adds a sign-in method. twoFactor adds a second step to sign-in.
"plugins": { "magicLink": { "enabled": true }, "emailOtp": { "enabled": true, "otpLength": 6 }, "passkey": { "enabled": true }, "twoFactor": { "enabled": true, "otp": { "enabled": true } } }
| Setting | Values | Default |
|---|---|---|
|
|
Boolean |
|
|
|
300 to 86400 |
|
|
|
Boolean |
|
|
|
Boolean |
|
|
|
60 to 3600 |
|
|
|
4 to 10 digits |
|
|
|
Boolean |
|
|
|
Boolean |
|
|
|
Up to 5 |
Your |
|
|
1 to 253 characters |
The host of the one origin |
|
|
Boolean |
|
|
|
Boolean |
|
|
|
1 to 10. Required in a |
None |
Each genericOAuth provider takes a providerId (required: letters, digits, - and _), a name, a clientId and clientSecret as for a social provider, and scopes. It also takes either a discoveryUrl, or an authorizationUrl and a tokenUrl. A provider that isn’t OpenID Connect also needs a userInfoUrl. Each URL must start with https://. A deployment fails with CONFIG_RETRIEVAL_FAILED when two providers have the same providerId. It also fails when a provider has neither a discoveryUrl nor both an authorizationUrl and a tokenUrl.
User
user turns on account changes that a signed-in user makes themselves.
| Setting | Values | Default |
|---|---|---|
|
|
Boolean |
|
|
|
Boolean |
|
|
|
300 to 86400 |
|
With changeEmail.enabled, the confirmation link sent to the new address signs the user in when it’s opened in a browser with no session, such as on another device. The sign-up verification link doesn’t sign anyone in.
Session
session sets how long users stay signed in. Times are in seconds. For how sessions work, see User sessions.
| Setting | Values | Default |
|---|---|---|
|
|
300 to 31536000 |
|
|
|
0 to 31536000 |
|
|
|
0 to 31536000 |
|
Account
account.accountLinking links a sign-in through a new provider to an existing account with the same verified email address.
| Setting | Values | Default |
|---|---|---|
|
|
Boolean |
|
|
|
Up to 20 |
None |
Rate limit
rateLimit limits /auth requests from each client IP address, and auth email requests for each email address. It’s on by default in a deployed backend and off in the local backend. To turn it off for a test or CI backend, set enabled to false and deploy. The one-minute gap between emails to one address and the lockout after repeated wrong two-factor codes stay on. Keep it on for an app that real users sign in to.
"rateLimit": { "enabled": false }
rateLimit counts requests from each client address in 60-second windows. Each window allows 100 requests that send email with the shared sender, or 300 with your own SMTP server. It also allows 600 credential checks and 6,000 other requests. The client address is the one that connected to CloudFront, so all of your server’s own requests share one count.
For auth emails, your app can also make at most 5 requests to one address a minute. Password reset, resendVerificationEmail, email change, sign-in link, and sign-in code requests count together. The verification email that sign-up or sign-in sends, and the account deletion email, don’t count. Addresses that differ only by a +tag count as one, and a request counts even when no email goes out. For more information about other limits, see Quotas.
Advanced
advanced sets the auth cookies.
| Setting | Values | Default |
|---|---|---|
|
|
Boolean |
|
|
|
1 to 253 characters |
The host that the request was sent to, such as the backend URL’s host |
|
|
|
|
|
|
Boolean |
|
Platform
platform holds two Amplify settings: your own SMTP server and the managed sign-in page. For SMTP and email templates, see Auth emails. For the page, see Managed sign-in page.
"platform": { "customEmail": { "smtp": { "host": "email-smtp.us-east-1.amazonaws.com", // required "port": 587, // required "username": "${env:SMTP_USERNAME}", // required "password": "${env:SMTP_PASSWORD}", // required "from": "Acme <no-reply@example.com>", // required, 3 to 320 characters "replyTo": "support@example.com" // optional } }, "hostedUi": { "enabled": true } // serves the managed sign-in page; default false }
When you set smtp, the backend sends every auth email through your server.
Per-environment settings
An env.<name>.backend.auth block replaces the root block for that environment. Like the root block, it replaces the defaults whole, so give it its own emailAndPassword and appName. The local backend reads only the root block. This example keeps the dev server out of production:
{ "backend": { "auth": { "appName": "Acme Notes", "emailAndPassword": { "enabled": true }, "trustedOrigins": ["http://localhost:5173", "https://admin.example.com"] } }, "env": { "production": { "backend": { "auth": { "appName": "Acme Notes", "emailAndPassword": { "enabled": true }, "trustedOrigins": ["https://admin.example.com"] } } } } }
You can also store an environment’s auth settings with aws amplifygen3 env edit --env preview --auth-config auth.json. A deployment uses those settings only when amplify.jsonc has no auth block for that environment, in env.<name>.backend.auth or at the root. An empty "auth": {} counts as a block. The path must be a regular file. To go back to the defaults, deploy "auth": {}, or store an empty file and deploy.
Secrets
Client secrets, the SMTP user name and the SMTP password must each be a ${env:NAME} reference.
For the local backend, put NAME=value lines in .secrets/client_secrets.env. Git ignores that file. For a deployed environment, store each value as a secret BACKEND variable, with --secret, before you deploy. A deployment fails with CONFIG_RETRIEVAL_FAILED when a referenced name has no value or isn’t a secret.
printf %s "$GOOGLE_CLIENT_SECRET" | aws amplifygen3 var set GOOGLE_CLIENT_SECRET --secret --scope BACKEND --env production aws amplifygen3 var upload .secrets/client_secrets.env --scope BACKEND --secrets GOOGLE_CLIENT_SECRET,GITHUB_CLIENT_SECRET --env preview
aws amplifygen3 var download writes each secret with an empty value, so copy a secret into your local file by hand.
Check what an environment runs with
Run the following command:
aws amplifygen3 env get --env production
The Applied backend config (branch '<name>') block shows the auth settings that the live deployment sent, including your trustedOrigins list. The list leaves out the origins that Amplify trusts without an entry. The block shows (not reported) when the deployment sent no auth settings. With --output json, they’re in AppliedBackendConfig.Auth as a JSON string, so parse it before you read a setting. The Stored backend config block shows what aws amplifygen3 env edit stored.
Errors
| Error | When | Fix |
|---|---|---|
|
|
|
Fix the JSON |
|
|
|
Fix the key, then run |
|
|
|
Fix each line, then deploy |
|
|
The running local backend refused the edited block, and kept the previous settings |
Fix the block, then run |
|
|
A |
Add the line |
|
|
A deployment fails for one of these reasons. An |
Fix the block, list each origin exactly, or store the value with |
|
|
Sign-up with a block that leaves out |
Add |
|
|
Sign-in with a block that leaves out |
Add |
|
|
A browser call, or a |
Add the origin to |
|
|
A sensitive action with a session older than |
Ask the user to sign in again |
|
|
A provider sign-in for an email address that has an account, with linking off |
Turn on |
|
|
A rate limit was reached |
Wait the seconds in |