简体   繁体   English

AWS Amplify graphql 客户端 IAM 设置

[英]AWS Amplify graphql client IAM setup

I'm using the Amplify graphql client in my project.我在我的项目中使用Amplify graphql 客户端 After custom auth I have the Access Key ID and Secret Access Key.自定义身份验证后,我有访问密钥 ID 和秘密访问密钥。 I need to provide these to the Amplify configuration but I can find no documentation whatsoever about it.我需要将这些提供给 Amplify 配置,但我找不到任何关于它的文档。 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.它们是为 AWS Appsync SDK 而不是为 graphql 客户端指定的。

Any assistance or insights are greatly appreciated.非常感谢任何帮助或见解。 Thanks谢谢

I resolved it by using AWS.config我通过使用 AWS.config 解决了它

import AWS from "aws-sdk";

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

Amplify.configure then works fine Amplify.configure 然后工作正常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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