前提・実現したいこと
AWSのAmplifyを使用して、AppSyncをVueプロジェクトに導入しようとしています。
認証方式としてIAMを使いたいので、amplify add api
で設定を行う際、以下の項目でAWS_IAM
を選択しています。
Choose the default authorization type for the API : API Key AWS_IAM Amazon Cognito User Pool OPENID_CONNECT
発生している問題・エラーメッセージ
クライアントからAppSyncへリクエストを投げた際、以下のエラーが発生します。
Error: No credentials
API_KEYを認証方式として選択した際は問題ないのですが、なぜかIAMだとエラーになってしまいます?
API_KEYを使用する場合、以下のように鍵の情報を指定するのですが、IAMの場合だと認証方式のみの指定になっています。やはり認証情報をどこかで設定する必要があるのでしょうか?
IAMの知識があまりないので、初歩的な質問でしたら申し訳ありません。
API_KEYを使用するときの設定
//aws-exports.js const awsmobile = { "aws_project_region": "ap-northeast-1", "aws_appsync_graphqlEndpoint": "https://enmzu4qcefglpa5bxbgd7gp43u.appsync-api.ap-northeast-1.amazonaws.com/graphql", "aws_appsync_region": "ap-northeast-1", 'aws_appsync_authenticationType': 'API_KEY', 'aws_appsync_apiKey': 'da2-xxxxxxxxxxxxxxxxxxxxxxxxxx' }; export default awsmobile;
IAMを使用するときの設定
const awsmobile = { "aws_project_region": "ap-northeast-1", "aws_appsync_graphqlEndpoint": "https://enmzu4qcefglpa5bxbgd7gp43u.appsync-api.ap-northeast-1.amazonaws.com/graphql", "aws_appsync_region": "ap-northeast-1", "aws_appsync_authenticationType": "AWS_IAM" }; export default awsmobile;
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。