Reputation: 33345
const client = new AWSAppSyncClient({
url: AWSConfig.aws_appsync_graphqlEndpoint,
region: AWSConfig.aws_appsync_region,
auth: {
type: AWSConfig.aws_appsync_authenticationType,
jwtToken: () => req.headers.authorization,
},
disableOffline: true,
offlineConfig: {
keyPrefix: "myPrefix",
},
});
I have been able to secure my API calls on my server endpoint by configuring an AppSync client, but I was hoping to do the same but use the API client provided by AWSAmplify, wondering if it is even possible.
This is my original code with the API client, but I kept getting no user available error. Is there a configuration option I am missing that allows me to set the token?
const { data, errors } = await API.graphql(
{
query: listPlayers,
authMode: "AMAZON_COGNITO_USER_POOLS",
}
);
Upvotes: 1
Views: 280