Skip to content

Flutter v2 gen2 comment fixes #7598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
51ec5b5
chore: remove callout that should be in migration guide
khatruong2009 May 15, 2024
5d0f0f9
chore: remove unnecessary code snippet that originates from vCurrent
khatruong2009 May 15, 2024
d9fe525
chore: fix incorrect references to vCurrent fragments inside vPrev pages
khatruong2009 May 15, 2024
f0f6eaf
chore: remove unnecessary line for flutter custom challenge in both p…
khatruong2009 May 15, 2024
68a814f
chore: make function public in prev and current
khatruong2009 May 15, 2024
e36ae80
chore: remove "suppports-only-mobile"
khatruong2009 May 15, 2024
207b9e5
chore: remove unnecessary inline filters and put back an upload fragment
khatruong2009 May 15, 2024
62fea43
chore: remove unnecessary inline filter from graphql link
khatruong2009 May 15, 2024
113084d
chore: remove unintentionally added line
khatruong2009 May 15, 2024
e488279
chore: move flutter back to the top of the platforms list
khatruong2009 May 15, 2024
185486c
chore: delete before you begin snippet for grapql vprev
khatruong2009 May 15, 2024
9c4daf5
chore: add picture back in to vprev flutter storage page
khatruong2009 May 15, 2024
1339de9
chore: revert flutter import changes back to original
khatruong2009 May 15, 2024
caead54
chore: clean up preReq snippets
khatruong2009 May 15, 2024
afe203c
chore: add title="Terminal" showLineNumbers={false} to terminal snippets
khatruong2009 May 16, 2024
74f8138
chore: revert changes that are out of scope
khatruong2009 May 16, 2024
c4fabd0
chore: revert removal of inline filter and addition of white space
khatruong2009 May 16, 2024
fc68440
chore: revert changes that removed before you begin snippet
khatruong2009 May 16, 2024
bc863f4
chore: revert change to wording
khatruong2009 May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
The following are required, depending on which platforms you are targeting:
* [Install and configure Amplify CLI](/gen1/[platform]/tools/cli/start/set-up-cli/)

- An iOS configuration targeting at least iOS 13.0 and XCode version >=13.2
- An Android configuration targeting at least Android API level 24 (Android 7.0) or above
- Any browser supported by Flutter for Web (you can check the list of supported browsers [here](https://docs.flutter.dev/development/platform-integration/web/faq#which-web-browsers-are-supported-by-flutter))
- Any Windows OS meeting Flutter minimums
- macOS version 10.15 or higher
- Any Ubuntu Linux distribution meeting Flutter minimums
- For a full example please follow the [project setup walkthrough](/gen1/[platform]/prev/start/project-setup/create-application/)
Amplify Flutter requires a minimum target platform for iOS (13.0), Android (API level 24), and macOS (10.15). Additional setup is required for some target platforms. Please see the [platform setup](/gen1/[platform]/prev/start/project-setup/platform-setup/) guide for more details on platform specific setup.
13 changes: 0 additions & 13 deletions src/fragments/lib-v1/analytics/flutter/identifyuser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ You can get the current user's ID from the Amplify Auth category as shown per th

If you have asked for location access and received permission, you can also provide that in `UserProfileLocation`

<Callout>

Breaking changes from v0 to v1:

The Analytics- prefix of the original `AnalyticsUserProfile` and `AnalyticsUserProfileLocation` classes is removed. Furthermore, `AnalyticsProperties` is renamed to `CustomProperties`.


</Callout>

```dart
Future<void> addAnalyticsWithLocation({
required String userId,
Expand Down Expand Up @@ -43,7 +34,3 @@ Future<void> addAnalyticsWithLocation({
);
}
```

import flutter0 from "/src/fragments/lib/analytics/native_common/identify-use-cases.mdx";

<Fragments fragments={{flutter: flutter0}} />
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<BlockSwitcher>
<Block name="Amplify CLI (Create)">

> Prerequisites: [Install and configure](/gen1/[platform]/prev/start/project-setup/prerequisites/#install-and-configure-the-amplify-cli) the Amplify CLI in addition to the Amplify libraries and [necessary dependencies](/gen1/[platform]/prev/build-a-backend/auth/set-up-auth/#install-amplify-libraries).

To start provisioning auth resources in the backend, go to your project directory and **execute the command**:

```bash
amplify add auth
```

Enter the following when prompted:

```console
? Do you want to use the default authentication and security configuration?
`Default configuration`
? How do you want users to be able to sign in?
`Username`
? Do you want to configure advanced settings?
`No, I am done.`
```

> If you have previously enabled an Amplify category that uses Auth behind the scenes (e.g. API category), you can run the `amplify update auth` command to edit your configuration if needed.

To push your changes to the cloud, **execute the command**:

```bash
amplify push
```

import android5 from '/src/fragments/lib/auth/android/getting_started/12_amplifyConfig.mdx';

<Fragments fragments={{ android: android5 }} />

</Block>

<Block name="Amplify CLI (Import)">

> Prerequisites: [Install and configure](/gen1/[platform]/start/project-setup/prerequisites/#install-and-configure-the-amplify-cli) the Amplify CLI in addition to the Amplify libraries and [necessary dependencies](/gen1/[platform]/build-a-backend/auth/set-up-auth/#install-amplify-libraries).

To import existing Amazon Cognito resources into your Amplify project, **execute the command**:

```bash
amplify import auth
```

```console
? What type of auth resource do you want to import?
Cognito User Pool and Identity Pool
Cognito User Pool only
```

Once you've selected an option, you'll be able to search for and import an existing Cognito User Pool and Identity Pool (or User Pool only) within your AWS account. The `amplify import auth` command will also do the following:

- Automatically populate your Amplify Library configuration file (`amplifyconfiguration.json`) with your chosen Amazon Cognito resource information
- Provide your designated existing Cognito resource as the authentication & authorization mechanism for all auth-dependent categories (API, Storage and more)
- Enable Lambda functions to access the chosen Cognito resource if you permit it

> If you have previously enabled an Amplify category that uses Auth behind the scenes (e.g. API category), you can run the `amplify update auth` command to edit your configuration if needed.

After configuring your Authentication options, update your backend and deploy the service by running the `push` command:

```bash
amplify push
```

Now, the authentication service has been deployed and you can start using it. To view the deployed services in your project at any time, go to Amplify Console by running the following command:

```bash
amplify console
```

For more details, see how to [Use an existing Cognito User Pool and Identity Pool](/gen1/[platform]/tools/cli/commands/#auth-import).

</Block>

<Block name="Amplify Studio">

> Prerequisites: [Install and configure](/gen1/[platform]/start/project-setup/prerequisites/#install-and-configure-the-amplify-cli) the Amplify CLI in addition to the Amplify libraries and [necessary dependencies](/gen1/[platform]/build-a-backend/auth/set-up-auth/#install-amplify-libraries).

Amplify Studio allows you create auth resources, set up authorization rules, implement Multi-factor authentication (MFA), and more via an intuitive UI. To set up Authentication through the Amplify Studio, take the following steps:

1. **Sign in** to the [AWS Management Console](https://console.aws.amazon.com/console/home) and open [AWS Amplify](https://console.aws.amazon.com/amplify).
2. In the navigation pane, **choose an application**.
3. On the application information page, choose the **Backend environments** tab, then choose **Launch Studio**.
4. On the **Set up** menu, choose **Authentication**.
5. In the **Configure log in** section, choose a login mechanism to add from the **Add login mechanism** list. Valid options are _Username_, _Phone number_, _Facebook_, _Google_, _Amazon_, and _Sign in with Apple_. If you choose one of the social sign-in mechanisms (i.e. _Facebook_, _Google_, _Amazon_, or _Sign in with Apple_), you will also need to enter your _App ID_, _App Secret_, and redirect URLs.
6. (Optional) Add multi-factor authentication (MFA). MFA is set to **Off** by default. To turn on MFA, do the following in the **Multi-factor authentication** section:

- Choose **Enforced** to require MFA for all users or choose **Optional** to allow individual users to enable MFA.
- (Optional) Choose **SMS**, and enter your SMS message.
- (Optional) Choose **Authenticator Application** if you want your app to load with an authentication flow that includes sign up and sign in.

7. In the **Configure sign up** section, expand **Password protection settings** and customize the password policy settings to enforce. u6. Choose **Save and Deploy**. This starts a CloudFormation deployment with the progress displayed in the upper right corner of the page.
8. After creating and configuring your auth resources, you'll need to pull them down from Amplify Studio. To do so, simply click on "Local setup instructions" in the upper right hand corner of the Studio console and execute the CLI command it provides at the root directory of your app.

> You can also [import](/gen1/[platform]/tools/console/auth/import/) existing Amazon Cognito resources and [manage users and groups](/gen1/[platform]/tools/console/auth/user-management/) through the Amplify Studio UI.

</Block>

<Block name="Existing Resources">

If you are not using the Amplify CLI, existing Authentication resources from AWS (e.g. Amazon Cognito UserPools or Identity Pools) can be used with the Amplify Libraries by [manually creating a configuration file](/gen1/[platform]/start/project-setup/use-existing-resources/#add-an-existing-aws-resource-to-an-android-application) (`amplifyconfiguration.json`) and then updating the associated Plugin within it:

```jsx
{
"auth": {
"plugins": {
"awsCognitoAuthPlugin": {
"IdentityManager": {
"Default": {}
},
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "[COGNITO IDENTITY POOL ID]",
"Region": "[REGION]"
}
}
},
"CognitoUserPool": {
"Default": {
"PoolId": "[COGNITO USER POOL ID]",
"AppClientId": "[COGNITO USER POOL APP CLIENT ID]",
"Region": "[REGION]"
}
},
"Auth": {
"Default": {
"authenticationFlowType": "USER_SRP_AUTH",
"socialProviders": [],
"usernameAttributes": [],
"signupAttributes": [
"[SIGNUP MECHANISM]"
],
"passwordProtectionSettings": {
"passwordPolicyMinLength": [PASSWORD LENGTH],
"passwordPolicyCharacters": []
},
"mfaConfiguration": "OFF",
"mfaTypes": [
"[MFA TYPE]"
],
"verificationMechanisms": [
"[VERIFICATION MECHANISM]"
],
"OAuth": {
"WebDomain": "[YOUR COGNITO DOMAIN ]",
"AppClientId": "[COGNITO USER POOL APP CLIENT ID]",
"SignInRedirectURI": "[CUSTOM REDIRECT SCHEME AFTER SIGN IN, e.g. myapp://]",
"SignOutRedirectURI": "[CUSTOM REDIRECT SCHEME AFTER SIGN OUT, e.g. myapp://]",
"Scopes": [
"phone",
"email",
"openid",
"profile",
"aws.cognito.signin.user.admin"
]
}
}
}
}
}
}
}
```

- **CredentialsProvider**:
- **Cognito Identity**:
- **Default**:
- **PoolID**: ID of the Amazon Cognito Identity Pool (e.g. `us-east-1:123e4567-e89b-12d3-a456-426614174000`)
- **Region**: AWS Region where the resources are provisioned (e.g. `us-east-1`)
- **CognitoUserPool**:
- **Default**:
- **PoolId**: ID of the Amazon Cognito User Pool (e.g. `us-east-1_abcdefghi`)
- **AppClientId**: ID for the client used to authenticate against the user pool
- **Region**: AWS Region where the resources are provisioned (e.g. `us-east-1`)
- **Auth**:
- **Default**:
- **authenticationFlowType**: The authentication flow type, takes values `USER_SRP_AUTH`, `CUSTOM_AUTH`, and `USER_PASSWORD_AUTH`. Default is `USER_SRP_AUTH`.
- **OAuth**: Hosted UI Configuration (only include this if using the Hosted UI flow)
- **Scopes:** Scopes should match the scopes enables in Cognito under "App client settings"

If you are using a Cognito User Pool without a Cognito Identity Pool, you can omit the **CredentialsProvider** section in the configuration.

</Block>

</BlockSwitcher>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<BlockSwitcher>
<Block name="Amplify CLI (Create)">

> Prerequisites: [Install and configure](/[platform]/start/project-setup/prerequisites/#install-and-configure-the-amplify-cli) the Amplify CLI in addition to the Amplify libraries and [necessary dependencies](/[platform]/build-a-backend/auth/set-up-auth/#install-amplify-libraries).
> Prerequisites: [Install and configure](/gen1/[platform]/prev/start/project-setup/prerequisites/#install-and-configure-the-amplify-cli) the Amplify CLI in addition to the Amplify libraries and [necessary dependencies](/gen1/[platform]/prev/build-a-backend/auth/set-up-auth/#install-amplify-libraries).

To start provisioning auth resources in the backend, go to your project directory and **execute the command**:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ Once the user provides the correct response, they should be authenticated in you
<b>Special Handling on ConfirmSignIn</b>

During a `confirmSignIn` call, if `failAuthentication: true` is returned by the Lambda, the session of the request gets invalidated by Cognito, and a `NotAuthorizedException` is thrown. To recover, the user must initiate a new sign in by calling `Amplify.Auth.signIn`.

Exception: `NotAuthorizedException` with a message `Invalid session for the user.`
</Callout>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Amplify Flutter supports [standard OIDC user attributes](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) as well as custom attributes. Custom attributes can be instantiated via the custom attribute constructor:

```dart
Future<void> _signUp({
Future<void> signUp({
required String username,
required String password,
required String email,
Expand All @@ -23,4 +23,4 @@ Future<void> _signUp({
}
```

When working with a Cognito UserPool, you can set up [custom attributes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-custom-attributes) via the Cognito console or AWS CLI. Although Cognito prepends a "custom:" prefix on the attribute name, there is no need for you to add this in Amplify Flutter's custom attribute constructor.
When working with a Cognito UserPool, you can set up [custom attributes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-custom-attributes) via the Cognito console or AWS CLI. Although Cognito prepends a "custom:" prefix on the attribute name, there is no need for you to add this in Amplify Flutter's custom attribute constructor.
Loading
Loading