问题
I created a AWS AppSync based GraphQL endpoint, which can be accessed by IAM users only. Now I want to consume this endpoint in C#.net. How can I access it via C#.Net.
I already tried APIKey authentication with GraphQL client library. But, not sure how to access same endpoint with AWS SDK.
回答1:
There is no SDK available for AWS AppSync - Data Plane API in AWS SDK for .NET. However there is an SDK for Control Plane Operations.
In order to use IAM based authorization for calls to AWS AppSync, you need to have valid Access Key and Secret Access Key and sign the HTTP requests sent to AWS AppSync using AWS SigV4 algorithm. You can take a look at the signing algorithm here.
You can use the Access and Secret Access Keys of an IAM user in your AWS account or you can use Amazon Cognito Identity Pools to retrieve short lived AWS Credentials that can be used to sign the HTTP request sent to AWS AppSync.
You can take a look at our implementation on iOS and Android for reference.
来源:https://stackoverflow.com/questions/56492202/how-to-access-aws-appsyc-based-graphql-endpoint-using-aws-sdk-for-net