简体   繁体   中英

AWS Amplify graphql client IAM setup

I'm using the Amplify graphql client in my project. After custom auth I have the Access Key ID and Secret Access Key. I need to provide these to the Amplify configuration but I can find no documentation whatsoever about it. The closest documentation I've seen is :

const myAppConfig = {
    // ...
    'aws_appsync_graphqlEndpoint': 'https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql',
    'aws_appsync_region': 'us-east-1',
    'aws_appsync_authenticationType': 'AWS_IAM',
    // ...
}

Amplify.configure(myAppConfig);

But it does not specify where should the credentials be entered. They are specified for the AWS Appsync SDK but not the graphql client.

Any assistance or insights are greatly appreciated. Thanks

I resolved it by using AWS.config

import AWS from "aws-sdk";

AWS.config.credentials = new AWS.Credentials(your credentials here)

Amplify.configure then works fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM