我有一个使用 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
}
Run Code Online (Sandbox Code Playgroud)
当我尝试使用创建新记录时
const triadeMetric = await DataStore.save(new TriadeMetric({}));
Run Code Online (Sandbox Code Playgroud)
我收到此警告消息:
[{"errorType":"Unauthorized","message":"Not Authorized to access onCreateTriade on type Triade"}]}
和这个错误:
{"errors":[{"errorType":"Unauthorized to access onCreateTriade on type Triade"}]}
zar*_*tra 17
I was using the wrong authentification type:
In aws-exports.js
I replaced "aws_appsync_authenticationType": "API_KEY"
with "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS"
| 归档时间: |
|
| 查看次数: |
7296 次 |
| 最近记录: |