【发布时间】:2016-08-20 07:30:32
【问题描述】:
在this page from the Amazon Cognito Developer Guide 中有一个代码示例:
idRequest.setIdentityId("14232"); <--- this line here is the line of concern
# please use Control/Command+F to find this line
更清晰的上下文的更广泛的代码视图如下:
// Create a new request to retrieve the token for your end user
GetOpenIdTokenForDeveloperIdentityRequest idRequest =
new GetOpenIdTokenForDeveloperIdentityRequest();
idRequest.setIdentityPoolId("YOUR_COGNITO_IDENTITY_POOL_ID");
idRequest.setIdentityId("14232");
在这里,我们准备在 Amazon Cognito 客户端中首次建立新用户的身份。
现在,我试图理解为什么我们在这里调用 setIdentityId() 而(在代码的这一点)我们仍然没有 Cognito 为我们提供任何身份?我们应该用什么来设置 IdentityId?为什么这里使用"14232"?
在Amazon Cognito API 的支持 Xamarin SDK 文档中,它说
当您要创建新身份时,IdentityId 应为 null。当您想将新登录与现有的已验证/未验证身份相关联时,您可以通过提供现有 IdentityId 来实现。
我很困惑,如果文档说“identityId 应该为空”当我们试图创建一个新的身份时,那为什么官方开发者指南中的代码示例使用 14232 而不是 null?
试图弄清楚这个新的 Cognito 事物。
【问题讨论】:
标签: amazon-web-services authentication identity amazon-cognito