amplifyapiadd-graphql-datasource授权问题
创始人
2024-08-10 01:01:47
0

在 Amplify API 中添加 GraphQL 数据源时遇到授权问题,可能是因为您在创建API时未正确配置API插件,也可能是访问授权密钥的问题。以下是解决此问题的示例代码:

  1. 确保已正确配置API插件

amplify configure api

按照提示进行插件配置,包括创建新API、选择API类型、命名和设置插件。

  1. 生成新的访问授权密钥

amplify update api

输入以下内容:

Please select from one of the below mentioned services GraphQL REST Please select the service that you want to update GraphQL What would you like to do? update Provide new service name or keep default: (you can default to GraphQL) GraphQL Choose the default authorization type for the API Amazon Cognito User Pool Enter a name for your user pool: (your generated new user pool name) How do you want users to be able to sign in? Username Do you want to add User Pool Groups? No Do you want to add an admin queries API? No Multifactor authentication (MFA) user login options: OFF Email based user registration/forgot password: Enabled (Requires per-user email id) Please specify an email verification subject: Your verification code Please specify an email verification message: Your verification code is {####} Please specify an email invitation subject [Leave blank for none]: Please specify an email invitation message [Leave blank for none]: Do you want to enable any of the following capabilities? (Press to select, to toggle all, to invert selection) ? User Sign-Up & Sign-In (EMAIL) ? User Sign-Up & Sign-In (PHONE_NUMBER) ? Email MFA ? SMS MFA (requires Email/SMS settings) ? User Settings ? Admin Queries ? Lambda Trigger ? Analytics ? Hosting (beta) Be extremely careful when granting premission for authenticated users to create roles. Authenticated users will be able to overwrite existing roles and create new roles. Please specify the IAM role name AmplifyAPIIntegration Successfully updated resource

  1. 将授权令牌添加到GraphQL数据源

amplify add api

按照提示输入以下内容:

? Please select from one of the below mentioned services GraphQL ? Provide a friendly name for your resource to be used as a label for this category in the project: datasourceName ? Provide the URL of your existing GraphQL API: ? Choose a default authentication type for the API API key ? Enter the API key value: ? Configure additional auth types? No

在这个过程中,您需要提供正确的访问授权密钥才能成功添加GraphQL数据源。

以上是针对Amplify API添加GraphQL数据源授权问题的解决方法。

相关内容

热门资讯

安卓换鸿蒙系统会卡吗,体验流畅... 最近手机圈可是热闹非凡呢!不少安卓用户都在议论纷纷,说鸿蒙系统要来啦!那么,安卓手机换上鸿蒙系统后,...
安卓系统拦截短信在哪,安卓系统... 你是不是也遇到了这种情况:手机里突然冒出了很多垃圾短信,烦不胜烦?别急,今天就来教你怎么在安卓系统里...
app安卓系统登录不了,解锁登... 最近是不是你也遇到了这样的烦恼:手机里那个心爱的APP,突然就登录不上了?别急,让我来帮你一步步排查...
安卓系统要维护多久,安卓系统维... 你有没有想过,你的安卓手机里那个陪伴你度过了无数日夜的安卓系统,它究竟要陪伴你多久呢?这个问题,估计...
windows官网系统多少钱 Windows官网系统价格一览:了解正版Windows的购买成本Windows 11官方价格解析微软...
安卓系统如何卸载app,轻松掌... 手机里的App越来越多,是不是感觉内存不够用了?别急,今天就来教你怎么轻松卸载安卓系统里的App,让...
怎么复制照片安卓系统,操作步骤... 亲爱的手机控们,是不是有时候想把自己的手机照片分享给朋友,或者备份到电脑上呢?别急,今天就来教你怎么...
安卓系统应用怎么重装,安卓应用... 手机里的安卓应用突然罢工了,是不是让你头疼不已?别急,今天就来手把手教你如何重装安卓系统应用,让你的...
iwatch怎么连接安卓系统,... 你有没有想过,那款时尚又实用的iWatch,竟然只能和iPhone好上好?别急,今天就来给你揭秘,怎...
iphone系统与安卓系统更新... 最近是不是你也遇到了这样的烦恼?手机更新系统总是失败,急得你团团转。别急,今天就来给你揭秘为什么iP...