使用 AWS Cognito 开发人员身份从我的 ios 应用程序获得对 DynamoDB 的完全访问权限

Getting full access to DynamoDB from my ios app using AWS Cognito Developer Identities(使用 AWS Cognito 开发人员身份从我的 ios 应用程序获得对 DynamoDB 的完全访问权限)
本文介绍了使用 AWS Cognito 开发人员身份从我的 ios 应用程序获得对 DynamoDB 的完全访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我已经实现了一个 AWS Lambda 函数并使用网关返回填充数据:

I have implemented a AWS Lambda function and used the gateway to return the fulling data:

var param =
{
    IdentityPoolId: "actualIdentityPoolId",
    Logins: {} // To have provider name in a variable
};
param.Logins["com.testing.userLogin"] = userId;

cognitoidentity.getOpenIdTokenForDeveloperIdentity(param,
function(err, data)
{
    if (err) return fn(err); // an error occurred
    else fn(null, data.IdentityId, data.Token); // successful response
});

因此,identityId 和 token 会被发送回 ios 设备.在我的设备中,我尝试连接到 AWS DynamoDB 表,但访问被拒绝.如何使用 identityId 和 token 来访问表?

So the identityId and token get sent back to the ios device. In my device I try to connect to an AWS DynamoDB table but access is denied. How do I use the identityId and token to gain access to the tables?

我在 IAM 中为 Unauth 设置了角色,该角色拒绝 Dydnamo 和 Auth,后者通过其策略授予对表的访问权限.

I have set up roles in IAM for Unauth which denies Dydnamo and Auth which gives access to the tables through its policies.

我正在尝试使用以下方式实现身份验证:http://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html

I am trying to implement authentication using: http://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html

我看到有两个流程,基本流程和增强流程.文档说大多数用户将使用增强的流程并实现 GetCredentialForIdentity.

I see there are two flows which are Basic and Enhanced. The documentation says most users will use the enhanced flow and that implements GetCredentialForIdentity.

这是如何在我的 ios 代码中实现的,以便我可以将我的角色从 unauth 切换到 auth 并可以访问 dynamodb?这种访问会持续多久?我想在我的 ios 代码中完成这一切,而不是使用 lambda 或其他类似的东西.

How is that implemented in my ios code so that I can switch my role from unauth to auth and can access to dynamodb? How long will this access last? I would like to do this all in my ios code instead of using lambda or something else like that.

推荐答案

如果您的用户未经身份验证,那么您需要在登录时清除您的凭据,并且您的登录"方法现在应该返回正确更新的登录映射.

If your user is unauthenticated, then logs in you need to clear your credentials, and your 'logins' method should now return a properly updated logins map.

以下是可帮助您的文档:http://docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html

Here is the documentation to help you: http://docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html

这篇关于使用 AWS Cognito 开发人员身份从我的 ios 应用程序获得对 DynamoDB 的完全访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

iOS 6 rotations: supportedInterfaceOrientations doesn#180;t work?(iOS 6 旋转:supportedInterfaceOrientations 不起作用?)
CABasicAnimation rotate returns to original position(CABasicAnimation 旋转返回原始位置)
UITabBarController Rotation Issues in ios 6(ios 6 中的 UITabBarController 旋转问题)
iOS: How to run a function after Device has Rotated (Swift)(iOS:设备旋转后如何运行函数(Swift))
How to rotate an image 90 degrees on iOS?(如何在 iOS 上将图像旋转 90 度?)
iOS 8 Rotation Methods Deprecation - Backwards Compatibility(iOS 8 旋转方法弃用 - 向后兼容性)