Getting full access to DynamoDB from my ios app using AWS Cognito Developer Identities(使用 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 的完全访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 AWS Cognito 开发人员身份从我的 ios 应用程序获得对 DynamoDB 的完全访问权限
基础教程推荐
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
