AppSync 堆栈身份池定义

问题描述 投票:0回答:1

我正在尝试将现有的 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
    }
typescript amazon-web-services aws-appsync aws-identitypools
1个回答
0
投票

试试这个

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
}
© www.soinside.com 2019 - 2024. All rights reserved.