我使用 Amplify 为 iOS 应用程序创建了一个书籍 API。我希望 book 表对经过身份验证和未经身份验证的用户都具有读取权限。这是架构:
type Book
@model
@searchable
@auth(
rules: [
{allow: private, provider: userPools, operations: [read]},
{allow: groups, groups: ["Admin"]}
]
)
{
id: ID!
category: BookCategoryType!
description: String
groupsCanAccess: [String]!
images: [Image!]
@auth(rules: [
{allow: groups, groupsField: "groupsCanAccess", operations: [read]},
{allow: groups, groups: ["Admin"]}
])
title: String!
}
但是,从 调用fetch
时AWSAppSyncClient
,出现以下错误:
authenticationError(AWSMobileClient.AWSMobileClientError.notSignedIn(message: "User is not signed in, please sign in to use this API."))
Cognito 身份池已Enable access to unauthenticated identities
检查并且存在未经身份验证的 IAM 角色。
可能是什么问题呢?