diff --git a/.eslintrc.json b/.eslintrc.json index 70bba30f2db..c2ef5673fde 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -30,7 +30,9 @@ }, "rules": { // for mdx shortcodes, and snippets - "react/jsx-no-undef": ["off"] + "react/jsx-no-undef": "off", + "react/no-unescaped-entities": "off", + "react-hooks/rules-of-hooks": "off" } }, { diff --git a/src/pages/[platform]/build-a-backend/auth/accessing-credentials/index.mdx b/src/pages/[platform]/build-a-backend/auth/accessing-credentials/index.mdx index 4fc0cb98678..3c90b96adf1 100644 --- a/src/pages/[platform]/build-a-backend/auth/accessing-credentials/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/accessing-credentials/index.mdx @@ -10,7 +10,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/add-sms-flows/index.mdx b/src/pages/[platform]/build-a-backend/auth/add-sms-flows/index.mdx index 2513db5ffe8..b64fd25ad7e 100644 --- a/src/pages/[platform]/build-a-backend/auth/add-sms-flows/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/add-sms-flows/index.mdx @@ -10,7 +10,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/add-social-provider/index.mdx b/src/pages/[platform]/build-a-backend/auth/add-social-provider/index.mdx index d3497bcaabb..de6ba10a812 100644 --- a/src/pages/[platform]/build-a-backend/auth/add-social-provider/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/add-social-provider/index.mdx @@ -2,7 +2,8 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; export const meta = { title: 'Add social provider sign-in', - description: 'Learn how to setup social sign-in providers like Facebook, Google, Amazon, or Sign in with Apple.', + description: + 'Learn how to setup social sign-in providers like Facebook, Google, Amazon, or Sign in with Apple.', platforms: [ 'javascript', 'react-native', @@ -16,18 +17,11 @@ export const meta = { ], canonicalObjects: [ { - platforms: [ - 'vue', - 'angular', - 'javascript' - ], + platforms: ['vue', 'angular', 'javascript'], canonicalPath: '/javascript/build-a-backend/auth/add-social-provider/' }, { - platforms: [ - 'react', - 'nextjs' - ], + platforms: ['react', 'nextjs'], canonicalPath: '/react/build-a-backend/auth/add-social-provider/' } ] @@ -37,7 +31,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, @@ -429,19 +423,19 @@ A custom state is not required, but if you are looking to add one, you are able ```ts -import { Hub } from "aws-amplify/utils"; -import { signInWithRedirect, getCurrentUser, AuthUser } from "aws-amplify/auth"; +import { Hub } from 'aws-amplify/utils'; +import { signInWithRedirect, getCurrentUser, AuthUser } from 'aws-amplify/auth'; -Hub.listen("auth", ({ payload }) => { +Hub.listen('auth', ({ payload }) => { switch (payload.event) { - case "signInWithRedirect": + case 'signInWithRedirect': const user = await getCurrentUser(); console.log(user.username); break; - case "signInWithRedirect_failure": + case 'signInWithRedirect_failure': // handle sign in failure break; - case "customOAuthState": + case 'customOAuthState': const state = payload.data; // this will be customState provided on signInWithRedirect function console.log(state); break; @@ -450,11 +444,12 @@ Hub.listen("auth", ({ payload }) => { function handleSignInClick(customState: string) { signInWithRedirect({ - provider: "Google", + provider: 'Google', customState }); } ``` + @@ -563,9 +558,9 @@ function App() { ```javascript -import React, { useEffect, useState } from "react"; -import { Hub } from "aws-amplify/utils"; -import { signInWithRedirect, signOut, getCurrentUser } from "aws-amplify/auth"; +import React, { useEffect, useState } from 'react'; +import { Hub } from 'aws-amplify/utils'; +import { signInWithRedirect, signOut, getCurrentUser } from 'aws-amplify/auth'; function App() { const [user, setUser] = useState(null); @@ -573,15 +568,15 @@ function App() { const [customState, setCustomState] = useState(null); useEffect(() => { - const unsubscribe = Hub.listen("auth", ({ payload }) => { + const unsubscribe = Hub.listen('auth', ({ payload }) => { switch (payload.event) { - case "signInWithRedirect": + case 'signInWithRedirect': getUser(); break; - case "signInWithRedirect_failure": - setError("An error has occurred during the OAuth flow."); + case 'signInWithRedirect_failure': + setError('An error has occurred during the OAuth flow.'); break; - case "customOAuthState": + case 'customOAuthState': setCustomState(payload.data); // this is the customState provided on signInWithRedirect function break; } @@ -598,23 +593,55 @@ function App() { setUser(currentUser); } catch (error) { console.error(error); - console.log("Not signed in"); + console.log('Not signed in'); } }; return (
- - + - - - @@ -671,7 +698,7 @@ function App(): JSX.Element { return unsubscribe; }, []); - + const getUser = async (): Promise => { try { const currentUser = await getCurrentUser(); @@ -697,15 +724,11 @@ function App(): JSX.Element { ```javascript -import React, { useEffect, useState } from "react"; -import { - Button, - SafeAreaView, - Text, -} from "react-native"; +import React, { useEffect, useState } from 'react'; +import { Button, SafeAreaView, Text } from 'react-native'; -import { getCurrentUser, signInWithRedirect, signOut } from "aws-amplify/auth"; -import { Hub } from "@aws-amplify/core"; +import { getCurrentUser, signInWithRedirect, signOut } from 'aws-amplify/auth'; +import { Hub } from '@aws-amplify/core'; function App() { const [user, setUser] = useState(null); @@ -713,15 +736,15 @@ function App() { const [customState, setCustomState] = useState(null); useEffect(() => { - const unsubscribe = Hub.listen("auth", ({ payload }) => { + const unsubscribe = Hub.listen('auth', ({ payload }) => { switch (payload.event) { - case "signInWithRedirect": + case 'signInWithRedirect': getUser(); break; - case "signInWithRedirect_failure": - setError("An error has occurred during the OAuth flow."); + case 'signInWithRedirect_failure': + setError('An error has occurred during the OAuth flow.'); break; - case "customOAuthState": + case 'customOAuthState': setCustomState(payload.data); break; } @@ -731,20 +754,23 @@ function App() { return unsubscribe; }, []); - + const getUser = async () => { try { const currentUser = await getCurrentUser(); setUser(currentUser); } catch (error) { console.error(error); - console.log("Not signed in"); + console.log('Not signed in'); } }; return ( - + {user?.username} {customState} @@ -974,10 +1000,18 @@ import 'aws-amplify/auth/enable-oauth-listener'; - - -When you import and use the `signInWithRedirect` function, it will add a listener as a side effect that will complete the social sign in when an end user is redirected back to your app. This works well in a single-page application but in a multi-page application, you might get redirected to a page that doesn't include the listener that was originally added as a side-effect. Hence you must include the specific OAuth listener on your login success page. - + + When you import and use the `signInWithRedirect` function, it will add a + listener as a side effect that will complete the social sign in when an end + user is redirected back to your app. This works well in a single-page + application but in a multi-page application, you might get redirected to a + page that doesn't include the listener that was originally added as a + side-effect. Hence you must include the specific OAuth listener on your login + success page. @@ -991,10 +1025,10 @@ import { signInWithRedirect } from 'aws-amplify/auth'; const provider = { custom: 'MyCustomOIDCProvider' -} +}; function handleSignInClick() { - signInWithRedirect({ provider }) + signInWithRedirect({ provider }); } ``` diff --git a/src/pages/[platform]/build-a-backend/auth/admin-actions/index.mdx b/src/pages/[platform]/build-a-backend/auth/admin-actions/index.mdx index d8ab6962eb1..89641c4fabc 100644 --- a/src/pages/[platform]/build-a-backend/auth/admin-actions/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/admin-actions/index.mdx @@ -1,8 +1,9 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; - + export const meta = { title: 'Set up admin actions', - description: 'Learn how to expose administrative actions for your Cognito User Pool to your end user applications.', + description: + 'Learn how to expose administrative actions for your Cognito User Pool to your end user applications.', platforms: [ 'android', 'angular', @@ -36,7 +37,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, @@ -54,7 +55,7 @@ For example, the ability to list all users in a Cognito User Pool may provide us The Amplify CLI can setup a REST endpoint with secure access to a Lambda function running with limited permissions to the User Pool if you wish to have these capabilities in your application, and you can choose to expose the actions to all users with a valid account or restrict to a specific User Pool Group. ## Enable Admin Queries - + @@ -66,10 +67,10 @@ Select the option to go through Manual configuration. ```console Do you want to use the default authentication and security configuration? (Use arrow keys) - Default configuration - Default configuration with Social Provider (Federation) -❯ Manual configuration - I want to learn more. + Default configuration + Default configuration with Social Provider (Federation) +❯ Manual configuration + I want to learn more. ``` Go through the rest of the configuration steps until you reach the following prompts: @@ -82,7 +83,7 @@ Go through the rest of the configuration steps until you reach the following pro ? Do you want to add an admin queries API? Yes ? Do you want to restrict access to the admin queries API to a specific Group? Yes ? Select the group to restrict access with: (Use arrow keys) -❯ Admins +❯ Admins Enter a custom group ``` @@ -145,48 +146,48 @@ To leverage this functionality in your app you would call the appropriate route ```js -import React from 'react' +import React from 'react'; import { Amplify } from 'aws-amplify'; import { fetchAuthSession } from 'aws-amplify/auth'; -import { post } from 'aws-amplify/api' +import { post } from 'aws-amplify/api'; import { withAuthenticator } from '@aws-amplify/ui-react'; import '@aws-amplify/ui-react/styles.css'; import amplifyconfig from './amplifyconfiguration.json'; Amplify.configure(amplifyconfig); -const client = generateClient() +const client = generateClient(); -async function addToGroup() { +async function addToGroup() { let apiName = 'AdminQueries'; let path = '/addUserToGroup'; let options = { - body: { - "username" : "richard", - "groupname": "Editors" - }, - headers: { - 'Content-Type' : 'application/json', - Authorization: `${(await fetchAuthSession()).tokens.accessToken.payload}` - } - } - return post({apiName, path, options}); + body: { + username: 'richard', + groupname: 'Editors' + }, + headers: { + 'Content-Type': 'application/json', + Authorization: `${(await fetchAuthSession()).tokens.accessToken.payload}` + } + }; + return post({ apiName, path, options }); } -async function listEditors(limit){ +async function listEditors(limit) { let apiName = 'AdminQueries'; let path = '/listUsersInGroup'; - let options = { - queryStringParameters: { - "groupname": "Editors", - "limit": limit, - }, - headers: { - 'Content-Type' : 'application/json', - Authorization: `${(await fetchAuthSession()).tokens.accessToken.payload}` - } - } - const response = await get({apiName, path, options}); + let options = { + queryStringParameters: { + groupname: 'Editors', + limit: limit + }, + headers: { + 'Content-Type': 'application/json', + Authorization: `${(await fetchAuthSession()).tokens.accessToken.payload}` + } + }; + const response = await get({ apiName, path, options }); return response; } @@ -277,22 +278,23 @@ func listEditors(groupName: String, limit: Int, nextToken: String? = nil) async await listEditors(groupName: "Editors", limit: 10) ``` -**Note: Cognito User Pool with HostedUI** +**Note: Cognito User Pool with HostedUI** -The Admin Queries API configuration in **amplifyconfiguration.json** will have the endpoint's authorization type set to `AMAZON_COGNITO_USER_POOLS`. With this authorization type, `Amplify.API` will perform the request with the access token. However, when using HostedUI, the app may get unauthorized responses despite being signed in, and will require using the ID Token. Set the authorizationType to "NONE" and add a custom interceptor to return the ID Token. +The Admin Queries API configuration in **amplifyconfiguration.json** will have the endpoint's authorization type set to `AMAZON_COGNITO_USER_POOLS`. With this authorization type, `Amplify.API` will perform the request with the access token. However, when using HostedUI, the app may get unauthorized responses despite being signed in, and will require using the ID Token. Set the authorizationType to "NONE" and add a custom interceptor to return the ID Token. ```json { - "awsAPIPlugin": { - "[YOUR-RESTENDPOINT-NAME]": { - "endpointType": "REST", - "endpoint": "[YOUR-REST-ENDPOINT]", - "region": "[REGION]", - "authorizationType": "NONE" - } + "awsAPIPlugin": { + "[YOUR-RESTENDPOINT-NAME]": { + "endpointType": "REST", + "endpoint": "[YOUR-REST-ENDPOINT]", + "region": "[REGION]", + "authorizationType": "NONE" } + } } ``` + If you perform additional updates to your resources using Amplify CLI, the authorizationType will be reverted back to `AMAZON_COGNITO_USER_POOLS`. Make sure to update this back to `NONE`. @@ -300,6 +302,7 @@ If you perform additional updates to your resources using Amplify CLI, the autho Add a custom interceptor to the API + ```swift try Amplify.configure() try Amplify.API.add(interceptor: MyCustomInterceptor(), for: "[YOUR-RESTENDPOINT-NAME]") @@ -333,6 +336,7 @@ class MyCustomInterceptor: URLRequestInterceptor { } } ``` + @@ -341,22 +345,24 @@ class MyCustomInterceptor: URLRequestInterceptor { To add additional admin actions that are not included by default but are enabled by Amazon Cognito, you will need to update the Lambda function code that is generated for you. The change will include adding a route handler for the action and creating a route for it. You will then associate the route handler to the route within the [Express](https://expressjs.com/) app. Below is an example of how to add an admin action that will allow you to [update a user's attributes](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminUpdateUserAttributes.html). + ```js async function updateUserAttributes(username, attributes) { - const params = { Username: username, UserAttributes: attributes, - UserPoolId: 'STRING_VALUE', + UserPoolId: 'STRING_VALUE' }; console.log(`Attempting to update ${username} attributes`); try { - await cognitoIdentityServiceProvider.adminUpdateUserAttributes(params).promise(); + await cognitoIdentityServiceProvider + .adminUpdateUserAttributes(params) + .promise(); console.log(`Success updating ${username} attributes`); return { - message: `Success updating ${username} attributes`, + message: `Success updating ${username} attributes` }; } catch (err) { console.log(err); @@ -364,9 +370,11 @@ async function updateUserAttributes(username, attributes) { } } ``` + Once the route handler is defined, you will then add a route with the correct HTTP method to the Express app and associate the route handler to the route. Be sure to make the route unique. Below is an example of how you can add a `POST` route named `/updateUserAttributes` and associate the above route handler to it. + ```js app.post('/updateUserAttributes', async (req, res, next) => { if (!req.body.username || !req.body.attributes) { @@ -376,7 +384,10 @@ app.post('/updateUserAttributes', async (req, res, next) => { } try { - const response = await updateUserAttributes(req.body.username, req.body.attributes); + const response = await updateUserAttributes( + req.body.username, + req.body.attributes + ); res.status(200).json(response); } catch (err) { next(err); diff --git a/src/pages/[platform]/build-a-backend/auth/advanced-workflows/index.mdx b/src/pages/[platform]/build-a-backend/auth/advanced-workflows/index.mdx index fed70b30970..47068dff72d 100644 --- a/src/pages/[platform]/build-a-backend/auth/advanced-workflows/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/advanced-workflows/index.mdx @@ -2,7 +2,8 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; export const meta = { title: 'Advanced workflows', - description: 'Learn more about advanced workflows in the Amplify auth category. This includes subscribing to events, identity pool federation, auth-related Lambda triggers and working with AWS service objects.', + description: + 'Learn more about advanced workflows in the Amplify auth category. This includes subscribing to events, identity pool federation, auth-related Lambda triggers and working with AWS service objects.', platforms: [ 'javascript', 'react-native', @@ -16,13 +17,7 @@ export const meta = { ], canonicalObjects: [ { - platforms: [ - 'vue', - 'javascript', - 'nextjs', - 'angular', - 'react' - ], + platforms: ['vue', 'javascript', 'nextjs', 'angular', 'react'], canonicalPath: '/javascript/build-a-backend/auth/advanced-workflows/' } ] @@ -32,7 +27,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/app-uninstall/index.mdx b/src/pages/[platform]/build-a-backend/auth/app-uninstall/index.mdx index cea082b1ba9..16710880da6 100644 --- a/src/pages/[platform]/build-a-backend/auth/app-uninstall/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/app-uninstall/index.mdx @@ -11,7 +11,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/auth-events/index.mdx b/src/pages/[platform]/build-a-backend/auth/auth-events/index.mdx index c3bc6a6d0c8..7543475403e 100644 --- a/src/pages/[platform]/build-a-backend/auth/auth-events/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/auth-events/index.mdx @@ -33,7 +33,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/auth-migration-guide/index.mdx b/src/pages/[platform]/build-a-backend/auth/auth-migration-guide/index.mdx index 16680a19d67..0798c5ceed5 100644 --- a/src/pages/[platform]/build-a-backend/auth/auth-migration-guide/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/auth-migration-guide/index.mdx @@ -2,7 +2,8 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; export const meta = { title: 'Migrate from v5 to v6', - description: 'Learn more about the migration steps to upgrade Auth APIs for Amplify JavaScript v5 to v6', + description: + 'Learn more about the migration steps to upgrade Auth APIs for Amplify JavaScript v5 to v6', platforms: [ 'angular', 'javascript', @@ -30,7 +31,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, @@ -43,13 +44,17 @@ The `Auth` category has moved to a functional approach and named parameters in A ## Auth.signUp -The overall input to `Auth.signUp` is largely unchanged, but how the object is structured is slightly different: `attributes` becomes `userAttributes` , and `userAttributes` and `validationData` are now under an `options` object. `autoSignIn` can also now be a simple boolean value. +The overall input to `Auth.signUp` is largely unchanged, but how the object is structured is slightly different: `attributes` becomes `userAttributes` , and `userAttributes` and `validationData` are now under an `options` object. `autoSignIn` can also now be a simple boolean value. A major difference is that a `CognitoUser` is no longer returned from `signUp`. All Auth API’s now use the current signed in user information to perform operations, so sending and receiving `CognitoUser` through every API is no longer required. Also notice that `userConfirmed` is no longer returned, and instead we return `nextStep`. This follows a standardized format shared between the `signUp`, `signIn`, `resetPassword`, and `updateUserAttributes` flows, where additional authentication steps will be returned with any additional information included in the same object (in this case, `codeDeliveryDetails`) -`autoSignIn` is no longer triggered automatically in v6 and will need to be called manually through a separate API when the `nextStep.signUpStep` is `COMPLETE_AUTO_SIGN_IN` + + `autoSignIn` is no longer triggered automatically in v6 and will need to be + called manually through a separate API when the `nextStep.signUpStep` is + `COMPLETE_AUTO_SIGN_IN` + @@ -85,7 +90,7 @@ Also notice that `userConfirmed` is no longer returned, and instead we return `n
**V6** - + ``` input: SignUpInput { username: string; @@ -107,6 +112,7 @@ Also notice that `userConfirmed` is no longer returned, and instead we return `n ```
+ @@ -131,7 +137,7 @@ Also notice that `userConfirmed` is no longer returned, and instead we return `n
**V6** - + ``` SignUpOutput { isSignUpComplete: boolean; @@ -143,7 +149,7 @@ Also notice that `userConfirmed` is no longer returned, and instead we return `n | 'COMPLETE_AUTO_SIGN_IN', codeDeliveryDetails: { // Not included when signUpStep is 'DONE' destination?: string; - deliveryMedium?: + deliveryMedium?: | 'EMAIL' | 'SMS' | 'PHONE' @@ -153,8 +159,9 @@ Also notice that `userConfirmed` is no longer returned, and instead we return `n }; } ``` - +
+ @@ -384,9 +391,16 @@ In the past, we've supported the ability to pass in `username`, `password`, `ema In v6, `confirmSignUp` now takes named parameters instead of positional parameters. You will send in an object with the properties `username`, `confirmationCode`, and `options`. This API also returns an object containing an `isSignUpComplete` flag, the `userId`, and `nextStep` for `autoSignIn` use cases in v6. -`autoSignIn` is no longer triggered automatically in v6 and will need to be called manually through a separate API when the `nextStep.signUpStep` is `COMPLETE_AUTO_SIGN_IN` + + `autoSignIn` is no longer triggered automatically in v6 and will need to be + called manually through a separate API when the `nextStep.signUpStep` is + `COMPLETE_AUTO_SIGN_IN` + -`forceAliasCreation` defaulted to `true` in v5 but is left `undefined` by default in v6 + + `forceAliasCreation` defaulted to `true` in v5 but is left `undefined` by + default in v6 + @@ -405,7 +419,7 @@ In v6, `confirmSignUp` now takes named parameters instead of positional paramete
**V6** - + ``` input: ConfirmSignUpInput = { username: string; @@ -418,6 +432,7 @@ In v6, `confirmSignUp` now takes named parameters instead of positional paramete ```
+
@@ -433,7 +448,7 @@ In v6, `confirmSignUp` now takes named parameters instead of positional paramete
**V6** - + ``` type ConfirmSignUpOutput = { isSignUpComplete: boolean; @@ -445,7 +460,7 @@ In v6, `confirmSignUp` now takes named parameters instead of positional paramete | 'COMPLETE_AUTO_SIGN_IN', codeDeliveryDetails: { // Not included when signUpStep is 'DONE' destination?: string; - deliveryMedium?: + deliveryMedium?: | 'EMAIL' | 'SMS' | 'PHONE' @@ -455,8 +470,9 @@ In v6, `confirmSignUp` now takes named parameters instead of positional paramete }; } ``` - +
+ @@ -501,7 +517,10 @@ In v6, `confirmSignUp` now takes named parameters instead of positional paramete ### Force Alias Creation -`forceAliasCreation` defaulted to `true` in v5 but is left `undefined` by default in v6 + + `forceAliasCreation` defaulted to `true` in v5 but is left `undefined` by + default in v6 + @@ -569,7 +588,7 @@ In v6, `resendSignUp` now takes named parameters instead of positional parameter
**V6** - + ``` input: ResendSignUpCodeInput { username: string; @@ -579,6 +598,7 @@ In v6, `resendSignUp` now takes named parameters instead of positional parameter } ```
+ @@ -651,7 +671,11 @@ A major difference is that a `CognitoUser` is no longer returned from `signIn`. Also notice that `challengeName` and `challengeParam` (returned in v5 as additional properties on the `CognitoUser`) are replaced in the output object by the `nextStep`property. `nextStep` includes `signInStep` and possibly additional props depending on the step. See [the Confirmation Required example](/[platform]/build-a-backend/auth/auth-migration-guide/#example-2-confirmation-required) for a detailed example of the new `signIn` flow. -The `signIn` API no longer accepts `validationData` in v6: in v5 `validationData` was not used because the underlying Cognito API does not accept `validationData` + + The `signIn` API no longer accepts `validationData` in v6: in v5 + `validationData` was not used because the underlying Cognito API does not + accept `validationData` + @@ -683,7 +707,7 @@ Also notice that `challengeName` and `challengeParam` (returned in v5 as additio
**V6** - + ``` input: SignInInput { username: string; @@ -701,6 +725,7 @@ Also notice that `challengeName` and `challengeParam` (returned in v5 as additio } ```
+
@@ -727,7 +752,7 @@ Also notice that `challengeName` and `challengeParam` (returned in v5 as additio
**V6** - + ``` type SignInOutput = { isSignedIn: boolean; @@ -749,6 +774,7 @@ Also notice that `challengeName` and `challengeParam` (returned in v5 as additio ```
+ @@ -993,7 +1019,11 @@ In the past, we've supported the ability to pass in `username`, `password` as po `Auth.federatedSignIn` has become `signInWithRedirect` in v6, but is otherwise similar. The `provider` property accepts specific strings instead of an enum and also includes an option to send in a custom provider if you would like to use a provider not in the default list. For this use case you would pass an object containing the prop `custom` to `provider` instead of one of the predefined strings. -The usage of `federatedSignIn` with Identity Pools is deprecated. If you are using an Identity Pool for authentication, please follow [this guide](/[platform]/build-a-backend/auth/advanced-workflows/#identity-pool-federation). + + The usage of `federatedSignIn` with Identity Pools is deprecated. If you are + using an Identity Pool for authentication, please follow [this + guide](/[platform]/build-a-backend/auth/advanced-workflows/#identity-pool-federation). + @@ -1041,7 +1071,7 @@ In the past, we've supported the ability to pass in `username`, `password` as po
**V6** - + ``` input?: SignInWithRedirectInput { provider?: @@ -1056,8 +1086,9 @@ In the past, we've supported the ability to pass in `username`, `password` as po }; } ``` - +
+
@@ -1085,6 +1116,7 @@ In the past, we've supported the ability to pass in `username`, `password` as po No output in v6 + @@ -1184,7 +1216,7 @@ In v6, `confirmSignIn` is now used not only for MFA confirmation, but also in pl Another major difference is that `CognitoUser` is no longer required as an input parameter or returned from `confirmSignIn`. All Auth API’s now use the current signed in user information to perform operations, so sending and receiving `CognitoUser` through every API is no longer required. -Also notice that `challengeName` and `challengeParam` (returned in v5 as additional properties on the `CognitoUser`) are replaced in the output object by the `nextStep` property. `nextStep` includes `signInStep` and possibly additional props depending on the step. +Also notice that `challengeName` and `challengeParam` (returned in v5 as additional properties on the `CognitoUser`) are replaced in the output object by the `nextStep` property. `nextStep` includes `signInStep` and possibly additional props depending on the step. @@ -1203,7 +1235,7 @@ Also notice that `challengeName` and `challengeParam` (returned in v5 as additio
**V6** - + ``` input: ConfirmSignInInput { challengeResponse: string; @@ -1217,6 +1249,7 @@ Also notice that `challengeName` and `challengeParam` (returned in v5 as additio } ```
+
@@ -1243,7 +1276,7 @@ Also notice that `challengeName` and `challengeParam` (returned in v5 as additio
**V6** - + ``` ConfirmSignInOutput { isSignedIn: boolean; @@ -1264,6 +1297,7 @@ Also notice that `challengeName` and `challengeParam` (returned in v5 as additio } ```
+ @@ -1324,6 +1358,7 @@ The output is no longer just a string representing the secret code, but an objec No input in v6 + @@ -1348,6 +1383,7 @@ The output is no longer just a string representing the secret code, but an objec ``` + @@ -1394,7 +1430,7 @@ In v6, `Auth.verifyTotpToken` has become `verifyTOTPSetup`, and the input has ch
**V6** - + ``` input: VerifyTOTPSetupInput { code: string; @@ -1405,6 +1441,7 @@ In v6, `Auth.verifyTotpToken` has become `verifyTOTPSetup`, and the input has ch ```
+ @@ -1429,6 +1466,7 @@ In v6, `Auth.verifyTotpToken` has become `verifyTOTPSetup`, and the input has ch No output in v6 + @@ -1477,7 +1515,7 @@ This API has been deprecated: existing use cases can be migrated to the `confirm
**V6** - + ``` input: ConfirmSignInInput { challengeResponse: string; @@ -1490,8 +1528,9 @@ This API has been deprecated: existing use cases can be migrated to the `confirm }; } ``` - +
+ @@ -1518,7 +1557,7 @@ This API has been deprecated: existing use cases can be migrated to the `confirm
**V6** - + ``` ConfirmSignInOutput { isSignedIn: boolean; @@ -1538,8 +1577,9 @@ This API has been deprecated: existing use cases can be migrated to the `confirm } } ``` - +
+ @@ -1597,7 +1637,7 @@ This API has been deprecated: existing use cases can be migrated to the `confirm
**V6** - + ``` input: ConfirmSignInInput { challengeResponse: string; @@ -1612,6 +1652,7 @@ This API has been deprecated: existing use cases can be migrated to the `confirm ```
+ @@ -1638,7 +1679,7 @@ This API has been deprecated: existing use cases can be migrated to the `confirm
**V6** - + ``` ConfirmSignInOutput { isSignedIn: boolean; @@ -1660,6 +1701,7 @@ This API has been deprecated: existing use cases can be migrated to the `confirm ```
+ @@ -1723,6 +1765,7 @@ In addition, Cognito only allows 1 option to be `preferred`. This can be achieve No input in v6 + @@ -1738,7 +1781,7 @@ In addition, Cognito only allows 1 option to be `preferred`. This can be achieve
**V6** - + ``` FetchMFAPreferenceOutput: { enabled?: ('SMS' | 'TOTP')[]; @@ -1747,6 +1790,7 @@ In addition, Cognito only allows 1 option to be `preferred`. This can be achieve ```
+ @@ -1797,7 +1841,7 @@ In v6, `Auth.setPreferredMFA` has been replaced by `updateMFAPreference`, which
**V6** - + ``` input: UpdateMFAPreferenceInput { sms?: @@ -1813,6 +1857,7 @@ In v6, `Auth.setPreferredMFA` has been replaced by `updateMFAPreference`, which } ```
+ @@ -1832,6 +1877,7 @@ In v6, `Auth.setPreferredMFA` has been replaced by `updateMFAPreference`, which No output in v6 + @@ -1878,6 +1924,7 @@ This API has been deprecated and results apply only to SMS MFA configurations: e No input in v6 + @@ -1896,7 +1943,7 @@ This API has been deprecated and results apply only to SMS MFA configurations: e
**V6** - + ``` FetchMFAPreferenceOutput: { enabled?: ('SMS' | 'TOTP')[]; @@ -1905,6 +1952,7 @@ This API has been deprecated and results apply only to SMS MFA configurations: e ```
+ @@ -1955,14 +2003,15 @@ The `signOut` API has not changed from v5 to v6 other than that it is now a func
**V6** - + ``` input?: SignOutInput { global: boolean; } ``` - +
+ @@ -2012,7 +2061,7 @@ The `Auth.changePassword` API has become `updatePassword` in v6. It now accepts
**V6** - + ``` input: UpdatePasswordInput { oldPassword: string; @@ -2020,6 +2069,7 @@ The `Auth.changePassword` API has become `updatePassword` in v6. It now accepts } ```
+ @@ -2039,6 +2089,7 @@ The `Auth.changePassword` API has become `updatePassword` in v6. It now accepts No output in v6 + @@ -2098,7 +2149,7 @@ In v6, the `Auth.forgotPassword` API has become `resetPassword`. It uses named p
**V6** - + ``` input: ResetPasswordInput { username: string; @@ -2111,6 +2162,7 @@ In v6, the `Auth.forgotPassword` API has become `resetPassword`. It uses named p ```
+ @@ -2132,20 +2184,20 @@ In v6, the `Auth.forgotPassword` API has become `resetPassword`. It uses named p
**V6** - + ``` ResetPasswordOutput { isPasswordReset: boolean; nextStep: { - resetPasswordStep: + resetPasswordStep: | 'CONFIRM_RESET_PASSWORD_WITH_CODE' | 'DONE'; - additionalInfo?: { + additionalInfo?: { [key: string]: string; }; codeDeliveryDetails: { destination?: string; - deliveryMedium?: + deliveryMedium?: | 'EMAIL' | 'SMS' | 'PHONE' @@ -2155,8 +2207,9 @@ In v6, the `Auth.forgotPassword` API has become `resetPassword`. It uses named p }; } ``` - +
+ @@ -2244,6 +2297,7 @@ In v6, the `Auth.forgotPassword` API has become `resetPassword`. It uses named p ``` + @@ -2262,6 +2316,7 @@ In v6, the `Auth.forgotPassword` API has become `resetPassword`. It uses named p No output in v6 + @@ -2357,7 +2412,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth
**V6** - + ``` // fetchAuthSession options?: FetchAuthSessionOptions { @@ -2366,6 +2421,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth ```
+ @@ -2390,7 +2446,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth
**V6** - + ``` // getCurrentUser GetCurrentUserOutput: { @@ -2398,7 +2454,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth userId: string; signInDetails?: { loginId?: string; - authFlowType?: + authFlowType?: | 'USER_SRP_AUTH' | 'CUSTOM_WITH_SRP' | 'CUSTOM_WITHOUT_SRP' @@ -2424,6 +2480,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth ```
+ @@ -2497,7 +2554,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth
**V6** - + ``` // fetchAuthSession options?: FetchAuthSessionOptions { @@ -2506,6 +2563,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth ```
+ @@ -2530,7 +2588,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth
**V6** - + ``` // getCurrentUser GetCurrentUserOutput: { @@ -2538,7 +2596,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth userId: string; signInDetails?: { loginId?: string; - authFlowType?: + authFlowType?: | 'USER_SRP_AUTH' | 'CUSTOM_WITH_SRP' | 'CUSTOM_WITHOUT_SRP' @@ -2564,6 +2622,7 @@ Also note that we no longer return `refreshToken` or `clockDrift` with the `Auth ```
+ @@ -2621,14 +2680,15 @@ Note that we no longer return `refreshToken` or `clockDrift` with the `AuthSessi
**V6** - + ``` options?: FetchAuthSessionOptions { forceRefresh?: boolean; } ``` - +
+ @@ -2649,7 +2709,7 @@ Note that we no longer return `refreshToken` or `clockDrift` with the `AuthSessi
**V6** - + ``` AuthSession { tokens?: { @@ -2668,6 +2728,7 @@ Note that we no longer return `refreshToken` or `clockDrift` with the `AuthSessi ```
+ @@ -2727,7 +2788,7 @@ Note that we no longer return `refreshToken` or `clockDrift` with the `AuthSessi
**V6** - + ``` options?: FetchAuthSessionOptions { forceRefresh?: boolean; @@ -2735,6 +2796,7 @@ Note that we no longer return `refreshToken` or `clockDrift` with the `AuthSessi ```
+ @@ -2755,7 +2817,7 @@ Note that we no longer return `refreshToken` or `clockDrift` with the `AuthSessi
**V6** - + ``` AuthSession { tokens?: { @@ -2774,6 +2836,7 @@ Note that we no longer return `refreshToken` or `clockDrift` with the `AuthSessi ```
+ @@ -2837,6 +2900,7 @@ The output has also changed: instead of an array of objects containing `Name` an No input in v6 + @@ -2855,7 +2919,7 @@ The output has also changed: instead of an array of objects containing `Name` an
**V6** - + ``` FetchUserAttributesOutput { [key: string]?: string; @@ -2863,6 +2927,7 @@ The output has also changed: instead of an array of objects containing `Name` an ```
+ @@ -2916,7 +2981,7 @@ Note that this API no longer accepts a `CognitoUser` as input. All Auth API’s
**V6** - + ``` input: UpdateUserAttributesInput { userAttributes: { @@ -2930,6 +2995,7 @@ Note that this API no longer accepts a `CognitoUser` as input. All Auth API’s } ```
+ @@ -2945,18 +3011,18 @@ Note that this API no longer accepts a `CognitoUser` as input. All Auth API’s
**V6** - + ``` UpdateUserAttributesOutput { [authKey in UserAttributeKey]: { isUpdated: boolean; nextStep: { - updateAttributeStep: + updateAttributeStep: | 'CONFIRM_ATTRIBUTE_WITH_CODE' | 'DONE'; codeDeliveryDetails?: { destination?: string; - deliveryMedium?: + deliveryMedium?: | 'EMAIL' | 'SMS' | 'PHONE' @@ -2968,6 +3034,7 @@ Note that this API no longer accepts a `CognitoUser` as input. All Auth API’s } ```
+ @@ -3019,7 +3086,7 @@ Note that this API no longer accepts a `CognitoUser` as input. All Auth API’s
**V6** - + ``` input: DeleteUserAttributesInput { userAttributeKeys: [UserAttributeKey, ...UserAttributeKey[]]; @@ -3027,6 +3094,7 @@ Note that this API no longer accepts a `CognitoUser` as input. All Auth API’s ```
+ @@ -3046,6 +3114,7 @@ Note that this API no longer accepts a `CognitoUser` as input. All Auth API’s No output in v6 + @@ -3095,7 +3164,7 @@ In v6, `Auth.verifyCurrentUserAttribute` becomes `sendUserAttributeVerificationC
**V6** - + ``` input: SendUserAttributeVerificationCodeInput { userAttributeKey: 'email' | 'phone_number'; @@ -3106,8 +3175,9 @@ In v6, `Auth.verifyCurrentUserAttribute` becomes `sendUserAttributeVerificationC }; } ``` - +
+ @@ -3121,7 +3191,7 @@ In v6, `Auth.verifyCurrentUserAttribute` becomes `sendUserAttributeVerificationC
**V6** - + ``` SendUserAttributeVerificationCodeOutput { destination?: string; @@ -3134,6 +3204,7 @@ In v6, `Auth.verifyCurrentUserAttribute` becomes `sendUserAttributeVerificationC } ```
+ @@ -3183,7 +3254,7 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T
**V6** - + ``` input: ConfirmUserAttributeInput { userAttributeKey: 'email' | 'phone_number'; @@ -3192,6 +3263,7 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T ```
+ @@ -3211,6 +3283,7 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T No output in v6 + @@ -3269,7 +3342,7 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T
**V6** - + ``` input: SendUserAttributeVerificationCodeInput { userAttributeKey: 'email' | 'phone_number'; @@ -3282,6 +3355,7 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T ```
+ @@ -3295,7 +3369,7 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T
**V6** - + ``` SendUserAttributeVerificationCodeOutput { destination?: string; @@ -3307,8 +3381,9 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T attributeName?: 'email' | 'phone_number'; } ``` - +
+ @@ -3369,7 +3444,7 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T
**V6** - + ``` input: ConfirmUserAttributeInput { userAttributeKey: 'email' | 'phone_number'; @@ -3378,6 +3453,7 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T ```
+ @@ -3397,6 +3473,7 @@ In v6, `Auth.verifyCurrentUserAttributeSubmit` becomes `confirmUserAttribute`. T No output in v6 + @@ -3457,6 +3534,7 @@ The `rememberDevice` API has not changed significantly from v5 to v6 other than No output in v6 + @@ -3497,7 +3575,7 @@ The `forgetDevice` API has not changed significantly from v5 to v6 other than th
**V6** - + ``` input?: ForgetDeviceInput { device?: { @@ -3507,6 +3585,7 @@ The `forgetDevice` API has not changed significantly from v5 to v6 other than th ```
+ @@ -3535,7 +3614,7 @@ The `forgetDevice` API has not changed significantly from v5 to v6 other than th ## Auth.currentCredentials (DEPRECATED) -This API has been deprecated: existing use cases can be migrated to the `fetchAuthSession` API. Note that `fetchAuthSession` will throw an error if there is no authenticated user. See the migration notes on [Auth.currentSession](/[platform]/build-a-backend/auth/auth-migration-guide/#authcurrentsession) for more details on how credentials differ between v5 and v6. +This API has been deprecated: existing use cases can be migrated to the `fetchAuthSession` API. Note that `fetchAuthSession` will throw an error if there is no authenticated user. See the migration notes on [Auth.currentSession](/[platform]/build-a-backend/auth/auth-migration-guide/#authcurrentsession) for more details on how credentials differ between v5 and v6. @@ -3547,7 +3626,7 @@ This API has been deprecated: existing use cases can be migrated to the `fetchAu
**V6** - + ``` options?: FetchAuthSessionOptions { forceRefresh?: boolean; @@ -3555,6 +3634,7 @@ This API has been deprecated: existing use cases can be migrated to the `fetchAu ```
+
@@ -3577,7 +3657,7 @@ This API has been deprecated: existing use cases can be migrated to the `fetchAu
**V6** - + ``` AuthSession { tokens?: { @@ -3596,6 +3676,7 @@ This API has been deprecated: existing use cases can be migrated to the `fetchAu ```
+ @@ -3663,14 +3744,15 @@ This API has been deprecated: existing use cases can be migrated to the `fetchAu
**V6** - + ``` options?: FetchAuthSessionOptions { forceRefresh?: boolean; } ``` - +
+ @@ -3693,7 +3775,7 @@ This API has been deprecated: existing use cases can be migrated to the `fetchAu
**V6** - + ``` AuthSession { tokens?: { @@ -3711,6 +3793,7 @@ This API has been deprecated: existing use cases can be migrated to the `fetchAu } ```
+ @@ -3809,6 +3892,7 @@ This API has been deprecated: existing use cases can be migrated by using a comb ``` + @@ -3873,6 +3957,7 @@ This API has been deprecated: existing use cases can be migrated to the `fetchUs No input in v6 + @@ -3905,6 +3990,7 @@ This API has been deprecated: existing use cases can be migrated to the `fetchUs ``` + @@ -3961,7 +4047,7 @@ Note that this API does not accept a `CognitoUser` as input. All Auth API’s no
**V6** - + ``` input: UpdateMFAPreferenceInput { sms?: @@ -3978,6 +4064,7 @@ Note that this API does not accept a `CognitoUser` as input. All Auth API’s no ```
+ @@ -3997,6 +4084,7 @@ Note that this API does not accept a `CognitoUser` as input. All Auth API’s no No output in v6 + @@ -4041,7 +4129,7 @@ Note that this API does not accept a `CognitoUser` as input. All Auth API’s no
**V6** - + ``` input: UpdateMFAPreferenceInput { sms?: @@ -4058,6 +4146,7 @@ Note that this API does not accept a `CognitoUser` as input. All Auth API’s no ```
+ @@ -4077,6 +4166,7 @@ Note that this API does not accept a `CognitoUser` as input. All Auth API’s no No output in v6 + diff --git a/src/pages/[platform]/build-a-backend/auth/data-usage-policy/index.mdx b/src/pages/[platform]/build-a-backend/auth/data-usage-policy/index.mdx index 137027ab21c..04d546464d4 100644 --- a/src/pages/[platform]/build-a-backend/auth/data-usage-policy/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/data-usage-policy/index.mdx @@ -2,19 +2,12 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; export const meta = { title: 'Data usage policy information', - description: "Review the data types gathered by the Amplify library that Apple requires you to disclose in your app's data usage policy when submitting the app to the App Store.", - platforms: [ - 'swift' - ], + description: + "Review the data types gathered by the Amplify library that Apple requires you to disclose in your app's data usage policy when submitting the app to the App Store.", + platforms: ['swift'], canonicalObjects: [ { - platforms: [ - 'swift', - 'swift', - 'swift', - 'swift', - 'swift' - ], + platforms: ['swift', 'swift', 'swift', 'swift', 'swift'], canonicalPath: '/swift/build-a-backend/auth/data-usage-policy/' } ] @@ -24,7 +17,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/delete-user-account/index.mdx b/src/pages/[platform]/build-a-backend/auth/delete-user-account/index.mdx index 9b635067a04..8a10c40b8f8 100644 --- a/src/pages/[platform]/build-a-backend/auth/delete-user-account/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/delete-user-account/index.mdx @@ -33,7 +33,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/enable-guest-access/index.mdx b/src/pages/[platform]/build-a-backend/auth/enable-guest-access/index.mdx index 65546120165..1bd1770013f 100644 --- a/src/pages/[platform]/build-a-backend/auth/enable-guest-access/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/enable-guest-access/index.mdx @@ -10,7 +10,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/enable-sign-in/index.mdx b/src/pages/[platform]/build-a-backend/auth/enable-sign-in/index.mdx index 43ddd85acd5..341bf77015f 100644 --- a/src/pages/[platform]/build-a-backend/auth/enable-sign-in/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/enable-sign-in/index.mdx @@ -11,7 +11,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/enable-sign-up/index.mdx b/src/pages/[platform]/build-a-backend/auth/enable-sign-up/index.mdx index 2f01faeef63..35cf028119f 100644 --- a/src/pages/[platform]/build-a-backend/auth/enable-sign-up/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/enable-sign-up/index.mdx @@ -2,7 +2,8 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; export const meta = { title: 'Enable sign-up, sign-in, and sign-out', - description: "Learn how to use Amplify's sign-up, sign-in, and sign-out APIs.", + description: + "Learn how to use Amplify's sign-up, sign-in, and sign-out APIs.", platforms: [ 'javascript', 'react-native', @@ -13,13 +14,7 @@ export const meta = { ], canonicalObjects: [ { - platforms: [ - 'nextjs', - 'angular', - 'javascript', - 'vue', - 'react' - ], + platforms: ['nextjs', 'angular', 'javascript', 'vue', 'react'], canonicalPath: '/javascript/build-a-backend/auth/enable-sign-up/' } ] @@ -29,7 +24,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/existing-resources/index.mdx b/src/pages/[platform]/build-a-backend/auth/existing-resources/index.mdx index c178748008e..62ae89a31a2 100644 --- a/src/pages/[platform]/build-a-backend/auth/existing-resources/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/existing-resources/index.mdx @@ -11,7 +11,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/import-existing-resources/index.mdx b/src/pages/[platform]/build-a-backend/auth/import-existing-resources/index.mdx index fd56bfdc3fd..9b83b7504a8 100644 --- a/src/pages/[platform]/build-a-backend/auth/import-existing-resources/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/import-existing-resources/index.mdx @@ -1,8 +1,9 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; - + export const meta = { title: 'Use an existing Cognito User Pool and Identity Pool', - description: 'Configure the Amplify CLI to use existing Amazon Cognito User Pool and Identity Pool resources as an authentication and authorization mechanism for other Amplify categories (API, Storage, and more).', + description: + 'Configure the Amplify CLI to use existing Amazon Cognito User Pool and Identity Pool resources as an authentication and authorization mechanism for other Amplify categories (API, Storage, and more).', platforms: [ 'android', 'angular', @@ -27,7 +28,8 @@ export const meta = { 'angular', 'react-native' ], - canonicalPath: '/javascript/build-a-backend/auth/import-existing-resources/' + canonicalPath: + '/javascript/build-a-backend/auth/import-existing-resources/' } ] }; @@ -36,7 +38,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, @@ -44,7 +46,6 @@ export function getStaticProps(context) { } }; } - Import existing Amazon Cognito resources into your Amplify project. Get started by running `amplify import auth` command to search for & import an existing Cognito User Pool & Identity Pool in your account. @@ -72,19 +73,19 @@ This feature is particularly useful if you're trying to: Select the "Cognito User Pool only" option when you've run `amplify import auth`. In order to successfully import your User Pool, your User Pools require at least one app client with the following conditions: -- *A "Web app client"*: an app client **without** a client secret +- _A "Web app client"_: an app client **without** a client secret Run `amplify push` to complete the import procedure. -import attributesCallout from "/src/fragments/common/writable-vs-mutable-attributes.mdx"; +import attributesCallout from '/src/fragments/common/writable-vs-mutable-attributes.mdx'; - + -Ensure that the hosted UI for an app client has a sign-out URL defined as omitting this may cause the Amplify CLI to not generate the OAuth `scopes`, `redirectSignIn`, `redirectSignOut` and `responseType` in the `aws-exports.js` file. +Ensure that the hosted UI for an app client has a sign-out URL defined as omitting this may cause the Amplify CLI to not generate the OAuth `scopes`, `redirectSignIn`, `redirectSignOut` and `responseType` in the `aws-exports.js` file. -If the Cognito user pool has native and web client defined ensure the clients have matching OAuth properties. +If the Cognito user pool has native and web client defined ensure the clients have matching OAuth properties. @@ -119,9 +120,9 @@ Run `amplify push` to complete the unlink procedure. In order to successfully build your application with Amplify Console add the following environmental variables to your build environment: -|Environment Variable|Description| -|-|-| -|AMPLIFY_USERPOOL_ID|The ID for the Amazon Cognito user pool imported for auth| -|AMPLIFY_WEBCLIENT_ID|The ID for the app client to be used by web applications. The app client must be configured with access to the Amazon Cognito user pool specified by the AMPLIFY_USERPOOL_ID environment variable.| -|AMPLIFY_NATIVECLIENT_ID|The ID for the app client to be used by native applications. The app client must be configured with access to the Amazon Cognito user pool specified by the AMPLIFY_USERPOOL_ID environment variable.| -|AMPLIFY_IDENTITYPOOL_ID|The ID for the Amazon Cognito identity pool| +| Environment Variable | Description | +| --- | --- | +| AMPLIFY_USERPOOL_ID | The ID for the Amazon Cognito user pool imported for auth | +| AMPLIFY_WEBCLIENT_ID | The ID for the app client to be used by web applications. The app client must be configured with access to the Amazon Cognito user pool specified by the AMPLIFY_USERPOOL_ID environment variable. | +| AMPLIFY_NATIVECLIENT_ID | The ID for the app client to be used by native applications. The app client must be configured with access to the Amazon Cognito user pool specified by the AMPLIFY_USERPOOL_ID environment variable. | +| AMPLIFY_IDENTITYPOOL_ID | The ID for the Amazon Cognito identity pool | diff --git a/src/pages/[platform]/build-a-backend/auth/index.mdx b/src/pages/[platform]/build-a-backend/auth/index.mdx index 626c726429f..527b2595540 100644 --- a/src/pages/[platform]/build-a-backend/auth/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/index.mdx @@ -3,7 +3,8 @@ import { getChildPageNodes } from '@/utils/getChildPageNodes'; export const meta = { title: 'Authentication', - description: 'Enable sign-in, sign-up and sign-out within minutes with pre-built UI components and powerful authentication APIs', + description: + 'Enable sign-in, sign-up and sign-out within minutes with pre-built UI components and powerful authentication APIs', platforms: [ 'android', 'angular', @@ -35,7 +36,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { const childPageNodes = getChildPageNodes(meta.route); return { props: { diff --git a/src/pages/[platform]/build-a-backend/auth/manage-mfa/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-mfa/index.mdx index 9ef25edd7c3..9c67ecfba96 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-mfa/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-mfa/index.mdx @@ -16,13 +16,7 @@ export const meta = { ], canonicalObjects: [ { - platforms: [ - 'angular', - 'nextjs', - 'vue', - 'javascript', - 'react' - ], + platforms: ['angular', 'nextjs', 'vue', 'javascript', 'react'], canonicalPath: '/javascript/build-a-backend/auth/manage-mfa/' } ] @@ -32,7 +26,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/manage-passwords/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-passwords/index.mdx index 940784310a0..7ada1da81bd 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-passwords/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-passwords/index.mdx @@ -33,7 +33,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/manage-user-profile/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-user-profile/index.mdx index e89b7f73cd1..cae38a810e1 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-user-profile/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-user-profile/index.mdx @@ -2,7 +2,8 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; export const meta = { title: 'Manage user profiles', - description: 'Learn more about how to enable customers to personalize their profile and verify their contact information with attributes.', + description: + 'Learn more about how to enable customers to personalize their profile and verify their contact information with attributes.', platforms: [ 'javascript', 'react-native', @@ -30,7 +31,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/manage-user-session/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-user-session/index.mdx index e4e415cfe09..b73a3064619 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-user-session/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-user-session/index.mdx @@ -30,7 +30,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, @@ -152,7 +152,7 @@ async function currentSession() { ### Refreshing sessions -The `fetchAuthSession` API automatically refreshes the user's session when the authentication tokens have expired and a valid `refreshToken` is present. Additionally, you can also refresh the session explicitly by calling the `fetchAuthSession` API with the `forceRefresh` flag enabled. +The `fetchAuthSession` API automatically refreshes the user's session when the authentication tokens have expired and a valid `refreshToken` is present. Additionally, you can also refresh the session explicitly by calling the `fetchAuthSession` API with the `forceRefresh` flag enabled. ```ts import { fetchAuthSession } from 'aws-amplify/auth'; diff --git a/src/pages/[platform]/build-a-backend/auth/managing-attributes/index.mdx b/src/pages/[platform]/build-a-backend/auth/managing-attributes/index.mdx index a8fe3f1cc81..cd7fd376944 100644 --- a/src/pages/[platform]/build-a-backend/auth/managing-attributes/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/managing-attributes/index.mdx @@ -10,7 +10,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/managing-credentials/index.mdx b/src/pages/[platform]/build-a-backend/auth/managing-credentials/index.mdx index 3b8e8b85c76..380e545b583 100644 --- a/src/pages/[platform]/build-a-backend/auth/managing-credentials/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/managing-credentials/index.mdx @@ -1,5 +1,5 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; - + export const meta = { title: 'Manage credentials', description: 'Learn how to customize credential storage.', @@ -10,7 +10,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, @@ -18,8 +18,6 @@ export function getStaticProps(context) { } }; } - - import flutter0 from '/src/fragments/lib/auth/flutter/managing_credentials/10_managing_credentials.mdx'; diff --git a/src/pages/[platform]/build-a-backend/auth/multi-step-sign-in/index.mdx b/src/pages/[platform]/build-a-backend/auth/multi-step-sign-in/index.mdx index 83bd751b65c..3f6725b1f6a 100644 --- a/src/pages/[platform]/build-a-backend/auth/multi-step-sign-in/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/multi-step-sign-in/index.mdx @@ -11,7 +11,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/override-cognito/index.mdx b/src/pages/[platform]/build-a-backend/auth/override-cognito/index.mdx index 346a21de42c..7da596c92d0 100644 --- a/src/pages/[platform]/build-a-backend/auth/override-cognito/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/override-cognito/index.mdx @@ -1,8 +1,9 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; - + export const meta = { title: 'Override Amplify-generated Cognito resources', - description: "The 'amplify override auth' command generates a developer-configurable 'overrides' TypeScript file that provides Amplify-generated Cognito resources as CDK constructs. For example, developers can set auth settings that are not directly available in the Amplify CLI workflow, such as the number of valid days for a temporary password.", + description: + "The 'amplify override auth' command generates a developer-configurable 'overrides' TypeScript file that provides Amplify-generated Cognito resources as CDK constructs. For example, developers can set auth settings that are not directly available in the Amplify CLI workflow, such as the number of valid days for a temporary password.", platforms: [ 'android', 'angular', @@ -36,7 +37,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, @@ -44,7 +45,6 @@ export function getStaticProps(context) { } }; } - ```bash amplify override auth @@ -62,12 +62,13 @@ Apply all the overrides in the `override(...)` function. For example, to update import { AmplifyAuthCognitoStackTemplate } from '@aws-amplify/cli-extensibility-helper'; export function override(resources: AmplifyAuthCognitoStackTemplate) { - resources.userPool.policies = { // Set the user pool policies + resources.userPool.policies = { + // Set the user pool policies passwordPolicy: { - ...resources.userPool.policies["passwordPolicy"], // Carry over existing settings + ...resources.userPool.policies['passwordPolicy'], // Carry over existing settings temporaryPasswordValidityDays: 3 // Add new setting not provided Amplify's default } - } + }; } ``` @@ -75,8 +76,7 @@ Or add a custom attribute to your Cognito user pool: -Removing or adding an attribute on a Cognito userpool schema including default attributes (e.g. `email`) will cause errors such as -`Invalid AttributeDataType input, consider using the provided AttributeDataType enum` as CloudFormation interprets this as schema change. +Removing or adding an attribute on a Cognito userpool schema including default attributes (e.g. `email`) will cause errors such as `Invalid AttributeDataType input, consider using the provided AttributeDataType enum` as CloudFormation interprets this as schema change. @@ -87,7 +87,7 @@ Custom attributes can not be renamed or deleted after you create them. ```ts -import { AmplifyAuthCognitoStackTemplate } from '@aws-amplify/cli-extensibility-helper' +import { AmplifyAuthCognitoStackTemplate } from '@aws-amplify/cli-extensibility-helper'; export function override(resources: AmplifyAuthCognitoStackTemplate) { const myCustomAttribute = { @@ -95,107 +95,107 @@ export function override(resources: AmplifyAuthCognitoStackTemplate) { developerOnlyAttribute: false, mutable: true, name: 'my_custom_attribute', - required: false, - } + required: false + }; resources.userPool.schema = [ ...(resources.userPool.schema as any[]), // Carry over existing attributes (example: email) - myCustomAttribute, - ] + myCustomAttribute + ]; } ``` You can override the following auth resources that Amplify generates: -|Amplify-generated resource|Description| -|-|-| -|[customMessageConfirmationBucket](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html)|S3 bucket used for custom message triggers| -|[snsRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html)|SNS role for sending authentication-related messages| -|[userPool](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html)|The Cognito user pool that enables user sign-up and sign-in| -|[userPoolClientWeb](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html)|A Cognito user pool client for web apps| -|[userPoolClient](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html)|A Cognito user pool client for mobile apps| -|[identityPool](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html)|A Cognito identity pool to federate identities| -|[identityPoolRoleMap](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypoolroleattachment.html)|Role mapping for authenticated and unauthenticated user roles| -|[lambdaConfigPermissions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html)|Permissions for Lambda function to access Cognito user pool and identity pool | -|[lambdaTriggerPermissions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM policy attached to Cognito Lambda triggers| -|[userPoolClientLambda](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)|Lambda function to fetch app client secret from user pool client| -|[userPoolClientRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html)|IAM Role for Lambda function to fetch app client secret from user pool client| -|[userPoolClientLambdaPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy for Lambda function to fetch app client secret from user pool client| -|[userPoolClientLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy to enable CloudWatch logging for Lambda function to fetch app client secret from user pool client| -|[userPoolClientInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html)|Custom CloudFormation resource to fetch app client secret from user pool client| -|[hostedUICustomResource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)|Lambda function to enable Cognito user pool Hosted UI login| -|[hostedUICustomResourcePolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy for Lambda function to enable Cognito user pool Hosted UI login| -|[hostedUICustomResourceLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy to enable CloudWatch logging for Lambda function to enable Cognito user pool Hosted UI login| -|[hostedUICustomResourceInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html)|Custom CloudFormation resource to enable Cognito user pool Hosted UI login| -|[hostedUIProvidersCustomResource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)|Lambda function to configure Hosted UI with 3rd party identity providers| -|[hostedUIProvidersCustomResourcePolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy for Lambda function to configure Hosted UI with 3rd party identity provider| -|[hostedUIProvidersCustomResourceLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy to enable CloudWatch logging for Lambda function to configure Hosted UI with 3rd party identity provider| -|[hostedUIProvidersCustomResourceInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html)|Custom CloudFormation resource to configure Hosted UI with 3rd party identity provider| -|[oAuthCustomResource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)|Lambda function to enable OAuth| -|[oAuthCustomResourcePolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy for OAuth custom CloudFormation resource| -|[oAuthCustomResourceLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy to enable CloudWatch logging for OAuth Lambda function| -|[oAuthCustomResourceInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html)|Custom CloudFormation resource to enable OAuth| -|[mfaLambda](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)|Lambda function to enable multi-factor authentication function| -|[mfaLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy to enable CloudWatch logging for multi-factor authentication Lambda function| -|[mfaLambdaPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy for multi-factor authentication Lambda function| -|[mfaLambdaInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html)|Custom CloudFormation resource to enable multi-factor authentication| -|[mfaLambdaRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html)|IAM Execution Role for multi-factor authentication Lambda function| -|[openIdLambda](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)|Lambda function to enable OpenID Connect| -|[openIdLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy to enable CloudWatch logging for OpenID Connect Lambda function| -|[openIdLambdaIAMPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)|IAM Policy to enable OpenID Connect Lambda function| -|[openIdLambdaInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html)|Custom CloudFormation resource to enable OpenID Connect| -|[openIdLambdaRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html)|Lambda Execution Role for OpenID Connect Lambda function| +| Amplify-generated resource | Description | +| --- | --- | +| [customMessageConfirmationBucket](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html) | S3 bucket used for custom message triggers | +| [snsRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html) | SNS role for sending authentication-related messages | +| [userPool](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html) | The Cognito user pool that enables user sign-up and sign-in | +| [userPoolClientWeb](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html) | A Cognito user pool client for web apps | +| [userPoolClient](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html) | A Cognito user pool client for mobile apps | +| [identityPool](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html) | A Cognito identity pool to federate identities | +| [identityPoolRoleMap](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypoolroleattachment.html) | Role mapping for authenticated and unauthenticated user roles | +| [lambdaConfigPermissions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html) | Permissions for Lambda function to access Cognito user pool and identity pool | +| [lambdaTriggerPermissions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM policy attached to Cognito Lambda triggers | +| [userPoolClientLambda](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) | Lambda function to fetch app client secret from user pool client | +| [userPoolClientRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html) | IAM Role for Lambda function to fetch app client secret from user pool client | +| [userPoolClientLambdaPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy for Lambda function to fetch app client secret from user pool client | +| [userPoolClientLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy to enable CloudWatch logging for Lambda function to fetch app client secret from user pool client | +| [userPoolClientInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html) | Custom CloudFormation resource to fetch app client secret from user pool client | +| [hostedUICustomResource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) | Lambda function to enable Cognito user pool Hosted UI login | +| [hostedUICustomResourcePolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy for Lambda function to enable Cognito user pool Hosted UI login | +| [hostedUICustomResourceLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy to enable CloudWatch logging for Lambda function to enable Cognito user pool Hosted UI login | +| [hostedUICustomResourceInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html) | Custom CloudFormation resource to enable Cognito user pool Hosted UI login | +| [hostedUIProvidersCustomResource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) | Lambda function to configure Hosted UI with 3rd party identity providers | +| [hostedUIProvidersCustomResourcePolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy for Lambda function to configure Hosted UI with 3rd party identity provider | +| [hostedUIProvidersCustomResourceLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy to enable CloudWatch logging for Lambda function to configure Hosted UI with 3rd party identity provider | +| [hostedUIProvidersCustomResourceInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html) | Custom CloudFormation resource to configure Hosted UI with 3rd party identity provider | +| [oAuthCustomResource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) | Lambda function to enable OAuth | +| [oAuthCustomResourcePolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy for OAuth custom CloudFormation resource | +| [oAuthCustomResourceLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy to enable CloudWatch logging for OAuth Lambda function | +| [oAuthCustomResourceInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html) | Custom CloudFormation resource to enable OAuth | +| [mfaLambda](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) | Lambda function to enable multi-factor authentication function | +| [mfaLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy to enable CloudWatch logging for multi-factor authentication Lambda function | +| [mfaLambdaPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy for multi-factor authentication Lambda function | +| [mfaLambdaInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html) | Custom CloudFormation resource to enable multi-factor authentication | +| [mfaLambdaRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html) | IAM Execution Role for multi-factor authentication Lambda function | +| [openIdLambda](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) | Lambda function to enable OpenID Connect | +| [openIdLogPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy to enable CloudWatch logging for OpenID Connect Lambda function | +| [openIdLambdaIAMPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html) | IAM Policy to enable OpenID Connect Lambda function | +| [openIdLambdaInputs](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html) | Custom CloudFormation resource to enable OpenID Connect | +| [openIdLambdaRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html) | Lambda Execution Role for OpenID Connect Lambda function | ## Customize Amplify-generated Cognito user group resources Apply all the overrides in the `override(...)` function. For example to add a path to the lambda execution role that facilitates the user pool group to role mapping: + ```ts import { AmplifyUserPoolGroupStackTemplate } from '@aws-amplify/cli-extensibility-helper'; export function override(resources: AmplifyUserPoolGroupStackTemplate) { - resources.lambdaExecutionRole.path = "//" // Note: CFN does not allow you to modify the path after creation + resources.lambdaExecutionRole.path = '//'; // Note: CFN does not allow you to modify the path after creation } ``` You can override the following user pool group resources that Amplify generates: -|Amplify-generated resource|Description| -|-|-| -|[userPoolGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolgroup.html)|The map of user pool groups| -|[userPoolGroupRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html)|The map of user pool group roles| -|[roleMapCustomResource](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html)|A custom CloudFormation resource to map user pool groups to their roles| -|[lambdaExecutionRole](https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html)|Lambda execution role for the "user pool group"-to-role mapping function| -|[roleMapLambdaFunction](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)|The Lambda function that facilitates the user pool group to role mapping| - +| Amplify-generated resource | Description | +| --- | --- | +| [userPoolGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolgroup.html) | The map of user pool groups | +| [userPoolGroupRole](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html) | The map of user pool group roles | +| [roleMapCustomResource](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudformation.CustomResource.html) | A custom CloudFormation resource to map user pool groups to their roles | +| [lambdaExecutionRole](https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html) | Lambda execution role for the "user pool group"-to-role mapping function | +| [roleMapLambdaFunction](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) | The Lambda function that facilitates the user pool group to role mapping | ## Customize Amplify-generated Cognito auth resources with social providers Apply all the overrides in the `override(...)` function. For example to add social providers to your Cognito user pool: ```ts -import { AmplifyAuthCognitoStackTemplate } from "@aws-amplify/cli-extensibility-helper"; +import { AmplifyAuthCognitoStackTemplate } from '@aws-amplify/cli-extensibility-helper'; export function override(resources: AmplifyAuthCognitoStackTemplate) { resources.addCfnResource( { - type: "AWS::Cognito::UserPoolIdentityProvider", + type: 'AWS::Cognito::UserPoolIdentityProvider', properties: { AttributeMapping: { - preferred_username: "email", - email: "email" + preferred_username: 'email', + email: 'email' }, ProviderDetails: { - client_id: "test", - client_secret: "test", - authorize_scopes: "test", + client_id: 'test', + client_secret: 'test', + authorize_scopes: 'test' }, - ProviderName: "LoginWithAmazon", - ProviderType: "LoginWithAmazon", + ProviderName: 'LoginWithAmazon', + ProviderType: 'LoginWithAmazon', UserPoolId: { - Ref: "UserPool", - }, - }, + Ref: 'UserPool' + } + } }, - "amazon-social-provider" + 'amazon-social-provider' ); } ``` diff --git a/src/pages/[platform]/build-a-backend/auth/remember-device/index.mdx b/src/pages/[platform]/build-a-backend/auth/remember-device/index.mdx index 961eb048056..b0702d93f1e 100644 --- a/src/pages/[platform]/build-a-backend/auth/remember-device/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/remember-device/index.mdx @@ -2,7 +2,8 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; export const meta = { title: 'Remember a device', - description: 'You can use the device related features of Amazon Cognito UserPools by enabling the Devices features. Go to your Cognito UserPool, click on Devices in Left Navigation Menu and chose one of User Opt In or Always.', + description: + 'You can use the device related features of Amazon Cognito UserPools by enabling the Devices features. Go to your Cognito UserPool, click on Devices in Left Navigation Menu and chose one of User Opt In or Always.', platforms: [ 'javascript', 'react-native', @@ -16,13 +17,7 @@ export const meta = { ], canonicalObjects: [ { - platforms: [ - 'javascript', - 'nextjs', - 'vue', - 'angular', - 'react' - ], + platforms: ['javascript', 'nextjs', 'vue', 'angular', 'react'], canonicalPath: '/javascript/build-a-backend/auth/remember-device/' } ] @@ -32,7 +27,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/sdk/index.mdx b/src/pages/[platform]/build-a-backend/auth/sdk/index.mdx index 9e6a89753b7..83b1fb00794 100644 --- a/src/pages/[platform]/build-a-backend/auth/sdk/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/sdk/index.mdx @@ -10,7 +10,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, diff --git a/src/pages/[platform]/build-a-backend/auth/set-up-auth/index.mdx b/src/pages/[platform]/build-a-backend/auth/set-up-auth/index.mdx index 4364e72472e..aabf43df63f 100644 --- a/src/pages/[platform]/build-a-backend/auth/set-up-auth/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/set-up-auth/index.mdx @@ -2,7 +2,8 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; export const meta = { title: 'Set up Amplify Auth', - description: 'Amplify uses Amazon Cognito as the main authentication provider. Learn how to handle user registration, authentication, account recovery and other operations.', + description: + 'Amplify uses Amazon Cognito as the main authentication provider. Learn how to handle user registration, authentication, account recovery and other operations.', platforms: [ 'javascript', 'react-native', @@ -16,13 +17,7 @@ export const meta = { ], canonicalObjects: [ { - platforms: [ - 'react', - 'nextjs', - 'vue', - 'javascript', - 'angular' - ], + platforms: ['react', 'nextjs', 'vue', 'javascript', 'angular'], canonicalPath: '/javascript/build-a-backend/auth/set-up-auth/' } ] @@ -32,7 +27,7 @@ export const getStaticPaths = async () => { return getCustomStaticPath(meta.platforms); }; -export function getStaticProps(context) { +export function getStaticProps() { return { props: { platform: context.params.platform, @@ -433,8 +428,8 @@ The `Authenticator` component offers a simple way to add authentication flows in ```html