Skip to content

chore: addressed comments regarding removing split up context between… #7585

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 18 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
aa01637
chore: addressed comments regarding removing split up context between…
khatruong2009 May 14, 2024
f364546
chore: remove customize authorization modes page from gen1 prev
khatruong2009 May 14, 2024
df2221d
chore: change advanced workflows title back to the original
khatruong2009 May 14, 2024
dd9b568
chore: remove unnecessary inline filters between platforms
khatruong2009 May 14, 2024
d2e2f11
chore: update references in prev to lib-v1 i
khatruong2009 May 14, 2024
a6a2da4
chore: remove unnecessary inline filters and header changes from adva…
khatruong2009 May 14, 2024
5aef8e5
chore: correct macOS format
khatruong2009 May 14, 2024
0d787f8
chore: fix forget device wording
khatruong2009 May 14, 2024
1cbfc1d
chore: remove unnecessary header change in auth flows
khatruong2009 May 14, 2024
c7f8d7f
chore: fix html being used instead of markdown. Also change type infe…
khatruong2009 May 14, 2024
832263a
chore: remove inline filter for appsync limit callout
khatruong2009 May 14, 2024
5cfcc81
chore: change v1 references from lib to lib-v1
khatruong2009 May 14, 2024
f63b43d
chore: remove unnecessary inline filter
khatruong2009 May 14, 2024
1302b9f
chore: print to safePrint
khatruong2009 May 14, 2024
294a603
chore: change order of platforms back to original
khatruong2009 May 14, 2024
84e44aa
chore: fix flutter v1 MFA docs
khatruong2009 May 14, 2024
efa68da
Revert "chore: fix flutter v1 MFA docs"
khatruong2009 May 15, 2024
95633ea
chore: revert partial previous commit
khatruong2009 May 15, 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
3 changes: 0 additions & 3 deletions src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2233,9 +2233,6 @@ export const directory = {
{
path: 'src/pages/gen1/[platform]/prev/build-a-backend/graphqlapi/api-graphql-concepts/index.mdx'
},
{
path: 'src/pages/gen1/[platform]/prev/build-a-backend/graphqlapi/customize-authorization-modes/index.mdx'
},
{
path: 'src/pages/gen1/[platform]/prev/build-a-backend/graphqlapi/customize-authz-modes/index.mdx'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Future<void> _configureAmplify() async {

<Callout>

When running your app on MacOS you will need to enable keychain sharing in Xcode, as described in the [Project setup guide](/gen1/[platform]/prev/start/project-setup/platform-setup/#enable-keychain).
When running your app on macOS you will need to enable keychain sharing in Xcode, as described in the [Project setup guide](/gen1/[platform]/prev/start/project-setup/platform-setup/#enable-keychain).

</Callout>

Expand Down
8 changes: 0 additions & 8 deletions src/fragments/lib-v1/auth/common/device_features/common.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<InlineFilter filters={["flutter"]}>
<Callout>
The [device tracking and remembering](https://aws.amazon.com/blogs/mobile/tracking-and-remembering-devices-using-amazon-cognito-your-user-pools/) features are currently not available within the library when using the federated OAuth flow with Cognito User Pools or Hosted UI.
</Callout>
</InlineFilter>

Remembering a device is useful in conjunction with Multi-Factor Authentication (MFA). If MFA is enabled for an Amazon Cognito user pool, end users have to type in a security code received via e-mail or SMS each time they want to sign in. This increases security but comes at the expense of the user's experience.

Remembering a device allows the second factor requirement to be automatically met when the user signs in on that device, thereby reducing friction in the user experience.

## Configure Auth Category

<InlineFilter filters={["swift", "android"]}>
<Callout>
Device remembering functionality does not work if you use one of the web UI
sign in methods.
</Callout>
</InlineFilter>

To enable remembered device functionality, open the Cognito User Pool console. To do this, **go to your project directory** and **issue the command**:

Expand Down
4 changes: 2 additions & 2 deletions src/fragments/lib-v1/auth/common/sms/flows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ import all1 from "/src/fragments/lib-v1/auth/common/sms/add_verification.mdx";

<Fragments fragments={{all: all1}} />

### SMS MFA
### MFA

import all2 from "/src/fragments/lib-v1/auth/common/sms/add_mfa.mdx";

Expand All @@ -108,7 +108,7 @@ import all4 from "/src/fragments/lib-v1/auth/common/sms/update_verification.mdx"

<Fragments fragments={{all: all4}} />

### SMS MFA
### MFA

import all5 from "/src/fragments/lib-v1/auth/common/sms/update_mfa.mdx";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
However, if you need to access them in relation to working with an API outside Amplify or want access to AWS specific identifying information (e.g. IdentityId), you can access these implementation details by calling fetchAuthSession on the Cognito Auth Plugin. This will return a `CognitoAuthSession`, which has additional attributes compared to `AuthSession`, which is typically returned by fetchAuthSession. See the example below:

```dart
Future<void> fetchAuthSession() async {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Future<void> forgetCurrentDevice() async {

```dart
// A device that was fetched via Amplify.Auth.fetchDevices()
Future<void> forgetSpecificDevice(AuthDevice myDevice) async {
Future<void> forgetSpecificDevice(AuthDevice registeredDevice) async {
try {
await Amplify.Auth.forgetDevice(myDevice);
await Amplify.Auth.forgetDevice(registeredDevice);
safePrint('Forget device succeeded');
} on AuthException catch (e) {
safePrint('Forget device failed with error: $e');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ To push your changes to the cloud, **execute the command**:
amplify push
```

import ios3 from '/src/fragments/lib/auth/ios/getting_started/12_amplifyConfig.mdx';

<Fragments fragments={{ swift: ios3 }} />

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

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

import flutter5 from '/src/fragments/lib/auth/flutter/getting_started/12_amplifyConfig.mdx';

<Fragments fragments={{ flutter: flutter5 }} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In terminal, navigate to your project, run `amplify add auth` (or if you've alre
? Enter your redirect signout URI:
`myapp://`
? Do you want to add another redirect signout URI
`No`
`Yes`
? Enter your redirect signout URI:
`http://localhost:3000/`
? Do you want to add another redirect signout URI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Sign-in with web UI will display the sign-in UI inside a webview. After the sign

## Platform Setup

<h3>Web</h3>
### Web

To use Hosted UI in your Flutter web application locally, you must run the app with the `--web-port=3000` argument (with the value being whichever port you assigned to localhost host when configuring your redirect URIs).

<h3>Android</h3>
### Android

Add the following `queries` element to the `AndroidManifest.xml` file in your app's `android/app/src/main` directory, as well as the following `intent-filter` to the `MainActivity` in the same file.

Expand Down Expand Up @@ -36,12 +36,12 @@ Replace `myapp` with your redirect URI scheme as necessary:
</application>
```

<h3>macOS</h3>
### macOS

Open XCode and enable the App Sandbox capability and then select "Incoming Connections (Server)" under "Network".

![Incoming Connections setting selected in the App Sandbox section of the runner signing and capabilities tab.](/images/project-setup/flutter/mac/xcode-entitlements.png)

<h3>iOS, Windows and Linux</h3>
### iOS, Windows and Linux

No specific platform configuration is required.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```dart
// Create state variables for the sign in status
var isSignedIn = false;
bool isSignedIn = false;
String? challengeHint;

Future<void> signInCustomFlow(String username) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ An intentional decision with Amplify Auth was to avoid any public methods exposi

With Auth, you simply sign in and it handles everything else needed to keep the credentials up to date and vend them to the other categories.

<InlineFilter filters={["swift", "android"]}>
However, if you need to access them in relation to working with an API outside Amplify or want access to AWS specific identifying information (e.g. IdentityId), you can access these implementation details by casting the result of fetchAuthSession as follows:
</InlineFilter>

import android0 from '/src/fragments/lib-v1/auth/android/access_credentials/10_fetchAuthSession.mdx';

Expand Down
36 changes: 4 additions & 32 deletions src/fragments/lib-v1/auth/native_common/signout/common.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<InlineFilter filters={['swift', 'android']} apiName="signOut" >
Invoke the `signOut` api to sign out a user from the Auth category. You can only have one user signed in at a given time.
</InlineFilter>

<InlineFilter filters={['flutter']} apiName="signOut" >
Invoke the `signOut` api to sign out a user from the Auth category. You can only have one user signed in at a given time. Calling signOut without any options will delete the local cache and keychain of the user and revoke the token if enabled on Amazon Cognito User Pools. If you would like to sign out of all devices, invoke the signOut api with advanced options.
</InlineFilter>

import android0 from '/src/fragments/lib-v1/auth/android/signout/10_local_signout.mdx';

Expand All @@ -18,35 +12,15 @@ import flutter2 from '/src/fragments/lib-v1/auth/flutter/signout/10_local_signou

<Fragments fragments={{ flutter: flutter2 }} />

<InlineFilter filters={['swift', 'android']} apiName="signOut" >
Calling signOut without any options will just delete the local cache and keychain of the user. If you would like to sign out of all devices, invoke the signOut api with advanced options.

[Amazon Cognito now supports token revocation](https://aws.amazon.com/about-aws/whats-new/2021/06/amazon-cognito-now-supports-targeted-sign-out-through-refresh-token-revocation/) and the latest Amplify version will revoke Amazon Cognito tokens if the application is online. This means that the Cognito refresh token cannot be used anymore to generate new Access and Id Tokens.

Access and Id Tokens are short-lived (60 minutes by default but can be set from 5 minutes to 1 day). After revocation, these tokens cannot be used with Cognito User Pools anymore. However, they are still valid when used with other services like AppSync or API Gateway.

For limiting subsequent calls to these other services after invalidating tokens, we recommend lowering token expiration time for your app client in the Cognito User Pools console. If you are using the Amplify CLI this can be accessed by running `amplify console auth`.

Token revocation is enabled automatically on new Amazon Cognito User Pools, however existing User Pools must enable this feature, [using the Cognito Console or AWS CLI](https://docs.aws.amazon.com/cognito/latest/developerguide/token-revocation.html).
</InlineFilter>

<InlineFilter filters={['flutter']} apiName="signOut" >
## Token Revocation

[Amazon Cognito now supports token revocation](https://aws.amazon.com/about-aws/whats-new/2021/06/amazon-cognito-now-supports-targeted-sign-out-through-refresh-token-revocation/). This means that the Cognito refresh token cannot be used anymore to generate new Access and Id Tokens.

Access and Id Tokens are short-lived (60 minutes by default but can be set from 5 minutes to 1 day). After revocation, these tokens cannot be used with Cognito User Pools anymore. However, they are still valid when used with other services like AppSync or API Gateway.

For limiting subsequent calls to these other services after invalidating tokens, we recommend lowering token expiration time for your app client in the Cognito User Pools console. If you are using the Amplify CLI this can be accessed by running `amplify console auth`.

Token revocation is enabled automatically on new Amazon Cognito User Pools, however existing User Pools must enable this feature, [using the Cognito Console or AWS CLI](https://docs.aws.amazon.com/cognito/latest/developerguide/token-revocation.html).
</InlineFilter>
Access and Id Tokens are short-lived (60 minutes by default but can be set from 5 minutes to 1 day). After revocation, these tokens cannot be used with Cognito user pool anymore. However, they are still valid when used with other services like AppSync or API Gateway.

<InlineFilter filters={['flutter']} apiName="signOut" >
## Global Sign Out
For limiting subsequent calls to these other services after invalidating tokens, we recommend lowering token expiration time for your app client in the Cognito user pool console. If you are using the Amplify CLI this can be accessed by running `amplify console auth`.

Calling signout with `globalSignOut = true` will invalidate all the Cognito User Pool tokens of the signed in user. If the user is signed into a device, they won't be authorized to perform a task that requires a valid token when a global signout is called from some other device. They need to sign in again to get valid tokens.
</InlineFilter>
Token revocation is enabled automatically on new Amazon Cognito user pools, however existing user pools must enable this feature, [using the Cognito Console or AWS CLI](https://docs.aws.amazon.com/cognito/latest/developerguide/token-revocation.html).

import android3 from '/src/fragments/lib-v1/auth/android/signout/20_global_signout.mdx';

Expand All @@ -60,11 +34,9 @@ import flutter5 from '/src/fragments/lib-v1/auth/flutter/signout/20_global_signo

<Fragments fragments={{ flutter: flutter5 }} />

<InlineFilter filters={['swift', 'android']} apiName="signOut" >
Calling signout with `globalSignOut = true` will invalidate all the Cognito User Pool tokens of the signed in user. If the user is signed into a device, they won't be authorized to perform a task that requires a valid token when a global signout is called from some other device. They need to sign in again to get valid tokens.
Calling signout with `globalSignOut = true` will invalidate all the Cognito user pool tokens of the signed in user. If the user is signed into a device, they won't be authorized to perform a task that requires a valid token when a global signout is called from some other device. They need to sign in again to get valid tokens.

<Callout warning>
Global signout functionality does not work if you use one of the web UI sign
in methods.
</Callout>
</InlineFilter>
2 changes: 0 additions & 2 deletions src/fragments/lib-v1/datastore/native_common/real-time.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

You can subscribe to changes on your Models. This reacts dynamically to updates of data to the underlying Storage Engine, which could be the result of GraphQL Subscriptions as well as Queries or Mutations that run against the backing AppSync API if you are synchronizing with the cloud.

<InlineFilter filters={['flutter']}>
<Callout info>
**NOTE:** AWS AppSync has an [adjustable limit of 100 subscriptions per connection](https://docs.aws.amazon.com/general/latest/gr/appsync.html). DataStore automatically subscribes to create, update, and delete mutations for all models.

Expand All @@ -12,7 +11,6 @@ This means that GraphQL APIs with DataStore enabled are limited to 33 models and

However, You can [request a service limit increase](https://console.aws.amazon.com/servicequotas/home/services/appsync/quotas/L-AA33EB36) from AWS AppSync to meet the real-time requirements of your application.
</Callout>
</InlineFilter>

import js0 from '/src/fragments/lib-v1/datastore/js/real-time/observe-snippet.mdx';

Expand Down
9 changes: 0 additions & 9 deletions src/fragments/lib-v1/graphqlapi/existing-resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@ Existing AWS AppSync resources can be used with the Amplify Libraries by referen
}
```

<InlineFilter filters={['swift','android',]}>
- **API NAME**: Friendly name for the API (e.g., _api_)
- **endpoint**: The HTTPS endpoint of the AWS AppSync API (e.g. `https://aaaaaaaaaaaaaaaaaaaaaaaaaa.appsync-api.us-east-1.amazonaws.com/graphql`). [Custom domain names](https://docs.aws.amazon.com/appsync/latest/devguide/custom-domain-name.html) can also be supplied here (e.g. `https://api.yourdomain.com/graphql`). Custom domain names can have any format, but must end with `/graphql` (see https://graphql.org/learn/serving-over-http/#uris-routes).
- **region**: AWS Region where the resources are provisioned (e.g. _us-east-1_)
- **authorizationType**: Authorization mode for accessing the API. This can be one of: `AMAZON_COGNITO_USER_POOLS`, `AWS_IAM`, `OPENID_CONNECT`, or `API_KEY`. Each mode requires additional configuration parameters. See [Configure authorization modes](/gen1/[platform]/prev/build-a-backend/graphqlapi/customize-authz-modes) for details.
</InlineFilter>

<InlineFilter filters={['flutter',]}>
- **API NAME**: Friendly name for the API (e.g., _api_)
- **endpoint**: The HTTPS endpoint of the AWS AppSync API (e.g. `https://aaaaaaaaaaaaaaaaaaaaaaaaaa.appsync-api.us-east-1.amazonaws.com/graphql`). [Custom domain names](https://docs.aws.amazon.com/appsync/latest/devguide/custom-domain-name.html) can also be supplied here (e.g. `https://api.yourdomain.com/graphql`). Custom domain names can have any format, but must end with `/graphql` (see https://graphql.org/learn/serving-over-http/#uris-routes).
- **region**: AWS Region where the resources are provisioned (e.g. _us-east-1_)
- **authorizationType**: Authorization mode for accessing the API. This can be one of: `AMAZON_COGNITO_USER_POOLS`, `AWS_IAM`, `OPENID_CONNECT`, or `API_KEY`. Each mode requires additional configuration parameters. See [Configure authorization modes](/gen1/[platform]/prev/build-a-backend/graphqlapi/customize-authorization-modes) for details.
</InlineFilter>

Note that before you can add an AWS resource to your application, the application must have the Amplify libraries installed. If you need to perform this step, see [Install Amplify Libraries](/gen1/[platform]/prev/start/project-setup/create-application/#n2-install-amplify-libraries).
8 changes: 4 additions & 4 deletions src/fragments/lib-v1/graphqlapi/flutter/authz.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ and under the `awsAPIPlugin`

```

import flutter0 from "/src/fragments/lib/graphqlapi/flutter/authz/10_userpool.mdx";
import flutter0 from "/src/fragments/lib-v1/graphqlapi/flutter/authz/10_userpool.mdx";

<Fragments fragments={{flutter: flutter0}} />

Expand Down Expand Up @@ -78,7 +78,7 @@ and under the `awsAPIPlugin`

#### OIDC

import flutter1 from "/src/fragments/lib/graphqlapi/flutter/authz/20_oidc.mdx";
import flutter1 from "/src/fragments/lib-v1/graphqlapi/flutter/authz/20_oidc.mdx";

<Fragments fragments={{flutter: flutter1}} />

Expand Down Expand Up @@ -108,7 +108,7 @@ The `friendly_name` illustrated here is created from Amplify CLI prompt. There a
"authorizationType": "API_KEY",
"apiKey": "[API_KEY]"
},
"[FRIENDLY-NAME-API-WITH-IAM": {
"[FRIENDLY-NAME-API-WITH-IAM"]: {
"endpointType": "GraphQL",
"endpoint": "[GRAPHQL-ENDPOINT]",
"region": "[REGION]",
Expand All @@ -134,6 +134,6 @@ The `friendly_name` illustrated here is created from Amplify CLI prompt. There a

The `GRAPHQL-ENDPOINT` from AWS AppSync will look similar to `https://xyz.appsync-api.us-west-2.amazonaws.com/graphql`.

import flutter2 from "/src/fragments/lib/graphqlapi/flutter/authz/30_multi.mdx";
import flutter2 from "/src/fragments/lib-v1/graphqlapi/flutter/authz/30_multi.mdx";

<Fragments fragments={{flutter: flutter2}} />
2 changes: 1 addition & 1 deletion src/fragments/lib-v1/graphqlapi/flutter/authz/21_oidc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class CustomOIDCProvider extends OIDCAuthProvider {
}
```

import warning from "/src/fragments/lib/graphqlapi/flutter/authz/2X_add_plugin.mdx";
import warning from "/src/fragments/lib-v1/graphqlapi/flutter/authz/2X_add_plugin.mdx";

<Fragments fragments={{flutter: warning}} />
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class CustomFunctionProvider extends FunctionAuthProvider {
}
```

import warning from "/src/fragments/lib/graphqlapi/flutter/authz/2X_add_plugin.mdx";
import warning from "/src/fragments/lib-v1/graphqlapi/flutter/authz/2X_add_plugin.mdx";

<Fragments fragments={{flutter: warning}} />
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,9 @@ import flutter5 from '/src/fragments/lib-v1/graphqlapi/flutter/advanced-workflow

<Fragments fragments={{ flutter: flutter5 }} />

## Combining multiple GraphQL operations in a single request
## Combining Multiple Operations

<InlineFilter filters={['swift', 'android']} >
When you want to perform more than one operation in a single request, you can place them within the same document. For example, to retrieve a Post and a Todo
</InlineFilter>

<InlineFilter filters={['flutter']} >
GraphQL allows you to run multiple GraphQL operations (queries/mutations) as part of a single network request from the client code. To perform multiple operations in a single request, you can place them within the same GraphQL document. For example, to retrieve a Post and a Todo:
</InlineFilter>

import ios6 from '/src/fragments/lib-v1/graphqlapi/ios/advanced-workflows/40_multiple.mdx';

Expand All @@ -160,25 +154,15 @@ import flutter7 from '/src/fragments/lib-v1/graphqlapi/flutter/advanced-workflow

<Fragments fragments={{ flutter: flutter7 }} />

<InlineFilter filters={['flutter']} >
<Callout>

Combining multiple GraphQL requests on the client-side is different than server-side transaction support. To run multiple transactions as a batch operation refer to the [Batch Put Custom Resolver](/gen1/[platform]/build-a-backend/graphqlapi/best-practice/batch-put-custom-resolver/) example.

</Callout>
</InlineFilter>

## Adding Headers to Outgoing Requests

By default, the API plugin includes appropriate authorization headers on your outgoing requests. However, you may have an advanced use case where you wish to send additional request headers to AppSync.

<InlineFilter filters={['flutter']} >
<Callout>

If your API does not require any authorization or if you would like manipulate the request yourself, please refer to the [Set authorization mode to NONE](/gen1/[platform]/build-a-backend/graphqlapi/customize-authz-modes/#none)

</Callout>
</InlineFilter>

import ios8 from '/src/fragments/lib-v1/graphqlapi/ios/advanced-workflows/50_interceptor.mdx';

Expand Down
Loading
Loading