我将AWS Lambda函数与Cognito经过身份验证的用户配合使用 .
我现在正试图让未经身份验证的Cognito用户继续前进 .
我无法在后端找到任何方法来确定调用Lambda函数的当前用户是否经过身份验证或未经身份验证 .
我对用户的识别信息是他们的Cognito IdentityId,但我如何使用它来找出未经身份验证的?
我在Lambda中使用Python boto3.6 .
检查这个 http://boto3.readthedocs.io/en/latest/reference/services/cognito-identity.html#CognitoIdentity.Client.describe_identity
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
1 回答
检查这个
http://boto3.readthedocs.io/en/latest/reference/services/cognito-identity.html#CognitoIdentity.Client.describe_identity
如果是auth用户,您将获得登录 . 从来没有使用它,但我认为这是知道的方式
编辑:从OP:是的,这是正确的 - 重要的是返回值中缺少键“登录”意味着用户未经身份验证 .