1

我的AWS Lambda函数可以正常使用Cognito身份验证的用户。AWS Cognito - 如何确定未经身份验证的用户?

我现在试图让未经认证的Cognito用户去。

我无法在后端找到任何方式来确定当前调用Lambda函数的用户是否已通过身份验证或未经身份验证。

我有关于用户的标识信息是他们的Cognito IdentityId,但我怎样才能使用它来找出未经认证的?

我在Lambda中使用Python boto3.6。

回答

2

检查这个http://boto3.readthedocs.io/en/latest/reference/services/cognito-identity.html#CognitoIdentity.Client.describe_identity

你的登录,如果它是一个auth用户。从来没有使用它,但我认为这是知道的方式

编辑: 从OP:是这是正确的 - 重要的是,在返回的值中没有键“登录”意味着用户是未经验证。

res = client2.describe_identity(
    IdentityId=context.identity.cognito_identity_id 
) 
if ('Logins' not in res.keys()): 
    return True 
else: 
    return False 
+0

谢谢是的,这是正确的 - 重要的是,返回值中没有“登录”键就意味着用户未经过身份验证。 –

相关问题