Skip to content

Commit

Permalink
Merge pull request zino-hofmann#582 from HoodHub/update-readme-with-a…
Browse files Browse the repository at this point in the history
…ppsync

Add documentation about AppSync support
  • Loading branch information
micimize authored Mar 31, 2020
2 parents 72a8839 + b965d59 commit 4b71898
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/graphql_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,32 @@ In order to use the client, you `Query` and `Mutation` widgets to be wrapped wit
...
```

### AWS AppSync Support

#### Cognito Pools

To use with an AppSync GraphQL API that is authorized with AWS Cognito User Pools, simply pass the JWT token for your Cognito user session in to the `AuthLink`:

```dart
// Where `session` is a CognitorUserSession
// from amazon_cognito_identity_dart_2
final token = session.getAccessToken().getJwtToken();
final AuthLink authLink = AuthLink(
getToken: () => token,
);
```

See more: [Issue #209](https://github.com/zino-app/graphql-flutter/issues/209)

#### Other Authorization Types

API key, IAM, and Federated provider authorization could be accomplished through custom links, but it is not known to be supported. Anyone wanting to implement this can reference AWS' JS SDK `AuthLink` implementation.

- Making a custom link: [Comment on Issue 173](https://github.com/zino-app/graphql-flutter/issues/173#issuecomment-464435942)
- AWS JS SDK `auth-link.ts`: [aws-mobile-appsync-sdk-js:auth-link.ts](https://github.com/awslabs/aws-mobile-appsync-sdk-js/blob/master/packages/aws-appsync-auth-link/src/auth-link.ts)


### Offline Cache

The in-memory cache can automatically be saved to and restored from offline storage. Setting it up is as easy as wrapping your app with the `CacheProvider` widget.
Expand Down

0 comments on commit 4b71898

Please sign in to comment.