我有一个使用 google federate 登录的 AWS Amplify 应用程序。
这是我的数据模型。
type TriadeMetric @model @auth(rules: [{allow: owner}]) {
id: ID!
NoteMetrics: [NoteMetric] @hasMany(indexName: "byTriadeMetric", fields: ["id"])
}
enum MetricEnum {
ACCURACY
DURATION
}
type NoteMetric @model @auth(rules: [{allow: owner}]) {
id: ID!
metricType: MetricEnum
value: Float
triademetricID: ID! @index(name: "byTriadeMetric")
semitones: Int
}
当我尝试使用创建新记录时
const triadeMetric = await DataStore.save(new TriadeMetric({}));
我收到此警告消息:
[{"errorType":"Unauthorized","message":"Not Authorized to access onCreateTriade on type Triade"}]}
和这个错误:
{"errors":[{"errorType":"Unauthorized to access onCreateTriade on type Triade"}]}
我使用了错误的身份验证类型:
在 aws-exports.js 中
我更换了"aws_appsync_authenticationType": "API_KEY"
with "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)