cdu*_*dub 9 objective-c amazon-web-services ios amazon-dynamodb amazon-cognito
我已经实现了AWS Lambda函数并使用网关返回了填充数据:
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
});
Run Code Online (Sandbox Code Playgroud)
因此identityId和token被发送回ios设备.在我的设备中,我尝试连接到AWS DynamoDB表但访问被拒绝.如何使用identityId和token来获取对表的访问权限?
我已经在IAM中为Unauth设置了角色,它拒绝了Dydnamo和Auth,它通过其策略访问表.
我正在尝试使用以下方法实现身份验证:http://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html
我看到有两个流程是Basic和Enhanced.文档说大多数用户将使用增强的流程并实现GetCredentialForIdentity.
如何在我的ios代码中实现,以便我可以将我的角色从unauth切换到auth并可以访问dynamodb?这种访问会持续多长时间?我想在我的ios代码中完成所有操作,而不是使用lambda或其他类似的东西.
如果您的用户未经身份验证,则登录时您需要清除凭据,并且您的“登录”方法现在应该返回正确更新的登录映射。
以下是可以帮助您的文档: http://docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html
归档时间: |
|
查看次数: |
464 次 |
最近记录: |