Skip to content

Commit 8b4c806

Browse files
committed
PR comments
1 parent 4263abe commit 8b4c806

File tree

1 file changed

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

1 file changed

+28
-20
lines changed

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

+28-20
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ Enter its GitHub URL (`https://github.com/aws-amplify/aws-appsync-apollo-extensi
102102

103103
<InlineFilter filters={["android"]}>
104104

105+
### Creating the ApolloClient
106+
105107
<BlockSwitcher>
106108

107109
<Block name="With Amplify">
@@ -116,8 +118,28 @@ val apolloClient = ApolloClient.Builder()
116118
.appSync(connector.endpoint, connector.apiKeyAuthorizer())
117119
.build()
118120
```
121+
</Block>
122+
123+
<Block name="Without Amplify">
124+
You can create your Apollo client by using our provided AWS AppSync endpoint and authorizer classes.
119125

120-
### AppSync Authorizers
126+
```kotlin
127+
val endpoint = AppSyncEndpoint("<your_appsync_endpoint>")
128+
// Continue Reading to see more authorizer examples
129+
val authorizer = ApiKeyAuthorizer("[API_KEY]")
130+
val apolloClient = ApolloClient.Builder()
131+
.appSync(endpoint, authorizer)
132+
.build()
133+
```
134+
</Block>
135+
136+
</BlockSwitcher>
137+
138+
### Providing AppSync Authorizers
139+
140+
<BlockSwitcher>
141+
142+
<Block name="With Amplify">
121143

122144
The AWS AppSync Apollo Extensions library provides a number of Authorizer classes to match the various authorization strategies that may be in use in your schema. You should choose the appropriate Authorizer type for your authorization strategy. To read more about the strategies and their corresponding auth modes, see [Available authorization strategies](/[platform]/build-a-backend/data/customize-authz/#available-authorization-strategies).
123145

@@ -207,20 +229,6 @@ val authorizer = IamAuthorizer {
207229

208230
<Block name="Without Amplify">
209231

210-
You can create your Apollo client by using our provided AWS AppSync endpoint and authorizer classes.
211-
212-
```kotlin
213-
val endpoint = AppSyncEndpoint("<your_appsync_endpoint>")
214-
// Continue Reading to see more authorizer examples
215-
val authorizer = ApiKeyAuthorizer("[API_KEY]")
216-
217-
val apolloClient = ApolloClient.Builder()
218-
.appSync(endpoint, authorizer)
219-
.build()
220-
```
221-
222-
### AppSync Authorizers
223-
224232
AWS AppSync supports the following [authorization modes](https://docs.aws.amazon.com/appsync/latest/devguide/security-authz.html). Use the corresponding Authorizer that matches the chosen authorization type.
225233

226234
Some common ones are
@@ -283,7 +291,7 @@ val authorizer = IamAuthorizer { signRequestAndReturnHeaders(it) }
283291
<InlineFilter filters={["swift"]}>
284292
AWS AppSync supports the following [authorization modes](https://docs.aws.amazon.com/appsync/latest/devguide/security-authz.html):
285293

286-
### API_KEY
294+
#### API_KEY
287295

288296
```swift
289297
import AWSAppSyncApolloExtensions
@@ -292,7 +300,7 @@ let authorizer = APIKeyAuthorizer(apiKey: "[API_KEY]")
292300
let interceptor = AppSyncInterceptor(authorizer)
293301
```
294302

295-
### AMAZON_COGNITO_USER_POOLS
303+
#### AMAZON_COGNITO_USER_POOLS
296304

297305
If you are using Amplify Auth, you can create a method that retrieves the Cognito access token
298306

@@ -322,7 +330,7 @@ let authorizer = AuthTokenAuthorizer(fetchLatestAuthToken: getUserPoolAccessToke
322330
let interceptor = AppSyncInterceptor(authorizer)
323331
```
324332

325-
### AWS_IAM
333+
#### AWS_IAM
326334

327335
If you are using Amplify Auth, you can use the following method for AWS_IAM auth
328336

@@ -418,11 +426,11 @@ You can alternatively download the introspection schema using the [`fetch-schema
418426
<BlockSwitcher>
419427

420428
<Block name="With Amplify">
421-
### Amplify provided .graphql files
429+
#### Amplify provided .graphql files
422430
1. Within your Amplify Gen2 backend, run: `npx ampx generate graphql-client-code --format graphql-codegen --statement-target graphql --out graphql`
423431
2. Copy the generated files (`mutations.graphql`, `queries.graphql`, `subscriptions.graphql`) to your `{app}/src/main/graphql` folder as shown in the [Apollo documentation](https://www.apollographql.com/docs/kotlin#getting-started)
424432

425-
### Manual
433+
#### Manual
426434
1. Navigate to the **Queries** tab in your API on the [AWS AppSync console](https://console.aws.amazon.com/appsync/home). Here, you can test queries, mutations, and subscriptions in the GraphQL playground.
427435
2. Enter your GraphQL operation (query, mutation, or subscription) in the editor and click **Run** to execute it.
428436
3. Observe the request and response structure in the results. This gives you insight into the exact call patterns and structure that Apollo will use.

0 commit comments

Comments
 (0)