【发布时间】:2021-03-07 18:01:00
【问题描述】:
我正在尝试在 AWS AppSync 控制台中对 Queries Playground 进行身份验证。我创建了用户池并将其链接到 AppSync API,我还在 Cognito 用户池中创建了一个应用程序客户端(使用 CloudFormation 部署)。它出现在控制台中的Select the authorization provider to use for running queries on this page: 下。
当我运行测试查询时,我得到:
{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "Unable to parse JWT token."
}
]
}
这是我所期望的。可以选择Login with User Pools。问题是我无法选择任何Client ID,当我选择手动插入客户端ID 时,我输入的任何内容都会得到Invalid UserPoolId format。我正在尝试从用户池常规设置(格式 eu-west-2_xxxxxxxxx)中复制池 ID,但没有任何乐趣。顺便说一句,我没有使用 Amplify,也没有配置任何身份池。
编辑:
这里是 CloudFormation GraphQLApi 定义:
MyApi:
Type: AWS::AppSync::GraphQLApi
Properties:
Name: !Sub "${AWS::StackName}-api"
AuthenticationType: AMAZON_COGNITO_USER_POOLS
UserPoolConfig:
UserPoolId: !Ref UserPoolClient
AwsRegion: !Sub ${AWS::Region}
DefaultAction: ALLOW
【问题讨论】:
-
听起来像一个愚蠢的问题,但只是想排除这种可能性,你是如何将你的用户池链接到你的 GraphQL API 的?另外,API 和 User Pool 是否在同一个区域?
-
根本不是一个愚蠢的问题,您回头查看 CloudFormation yaml 发现了问题
标签: amazon-cognito aws-appsync aws-userpools