问题描述
我已经实现了一个 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 的完全访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)