Skip to content

Commit b0ab456

Browse files
Apply suggestions from code review
Co-authored-by: Matt Creaser <[email protected]>
1 parent 48829bd commit b0ab456

File tree

1 file changed

+5
-8
lines changed
  • src/pages/[platform]/build-a-backend/data/aws-appsync-apollo-extensions

1 file changed

+5
-8
lines changed

src/pages/[platform]/build-a-backend/data/aws-appsync-apollo-extensions/index.mdx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ let interceptor = AppSyncInterceptor(authorizer)
121121
Create the AuthTokenAuthorizer with this method.
122122

123123
```kotlin
124-
let authorizer = AuthTokenAuthorizer(fetchLatestAuthToken: getLatestTokenFromAmplify)
124+
val authorizer = AuthTokenAuthorizer { ApolloAmplifyConnector.fetchLatestCognitoAuthToken() }
125125
```
126126

127127
</InlineFilter>
@@ -224,7 +224,7 @@ The schema is used by Apollo’s code generation tool to generate API code that
224224
1. Navigate to your API on the [AWS AppSync console](https://console.aws.amazon.com/appsync/home)
225225
2. On the left side, select Schema
226226
3. When viewing your schema, there should a “Export schema” drop down. Select this and download the `schema.json` file.
227-
4. Add this file to your project as directed by [Apollo Code Generation documentation](https://www.apollographql.com/docs/ios/code-generation/introduction)
227+
4. Add this file to your project as directed by [Apollo documentation](https://www.apollographql.com/docs/kotlin/advanced/plugin-recipes#specifying-the-schema-location)
228228
</InlineFilter>
229229

230230
## Connecting to AWS AppSync real-time endpoint
@@ -273,14 +273,11 @@ func createApolloClient() throws -> ApolloClient {
273273
<InlineFilter filters={["android"]}>
274274

275275
```kotlin
276-
// Create the network transport
277-
val networkTransport = WebSocketNetworkTransport.Builder()
278-
.protocol(AppSyncProtocol.Factory(endpoint, authorizer))
279-
.build()
276+
val endpoint = AppSyncEndpoint("<your_appsync_endpoint>")
277+
val authorizer = /* your Authorizer */
280278

281-
// Use the network transport when creating the Apollo Client
282279
val apolloClient = ApolloClient.Builder()
283-
.subscriptionNetworkTransport(networkTransport)
280+
.appSync(endpoint, authorizer)
284281
.build()
285282
```
286283

0 commit comments

Comments
 (0)