如何更改AWS放大AppSync默认授权模式表单API键为Cognito用户池?
我正在使用 Amplify ,我将身份验证添加到了我的应用程序中,而我的GraphQl架构则使用prival private,所有事物在我的本地中效果很好,每个GraphQl API都称为,它包含 < strong>访问令牌 和appsync接受我的要求。 但是,当我部署应用程序时,我会遇到一个错误,因为我的所有GraphQl请求仍然 api-key nocess occess令牌。
在我的本地: 身份验证后所有细胞都很好。
在生产中: graphQl在身份验证之后仍在API-KEY
I'm working with Amplify, I added the authentication to my application and my graphQL schema is with rule private, all things work good in my local, each graphQl api called, It contains the access token and appSync accept my request.
But when I deploy my App, I get an error because all my graphQl request still with api-key not with access token.
In the console I use this configuration:
In my local : all thins work good after authentication.
In production : graphQl still with api-key after authentication
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于此文档> amplify update api :
从那里,命令行提示您选择API类型:
我更新了API的默认授权类型为
Amazon cognito cognito cognito用户池
而不是api键
。然后,我必须运行
amplify push -appid our_app_id -envname your_staging_env
才能同步更改。Based on this documentation I ran
amplify update api
:From there the command line prompts you to select the API type:
I updated the default authorization type for the API to be
Amazon Cognito User Pool
instead ofAPI key
.Then I had to run
amplify push --appId YOUR_APP_ID --envName YOUR_STAGING_ENV
to sync up the changes.