我正在尝试将现有的 IdentityPool 连接到我的 AppSync API 配置。 实例化新的 IdentityPool 时,我可以访问属性 .authenticatedUserRole 和 .unauthenticatedUserRole。但是当我使用方法 .fromIdentityPoolArn 或 .fromIdentityPoolId 来获取现有的 IdentityPool 时,我无法访问属性。为什么?!
const idPool = IdentityPool.fromIdentityPoolArn(this, 'importedIdentityPool', 'arn...');
我需要这个用于身份池配置:
identityPoolConfig: {
identityPoolId: takes a String,
authenticatedUserRole: takes IRole,
unauthenticatedUserRole: takes IRole
}
试试这个
import {Role } from 'aws-cdk-lib/aws-iam';
const authrole = Role.fromRoleArn(this, 'id', 'arn');
const unauthrole = Role.fromRoleArn(this, 'id', 'arn');
identityPoolConfig: {
identityPoolId: 'id',
authenticatedUserRole: authrole,
unauthenticatedUserRole: unauthrole
}