阐明用户识别的 AWS 教程 - 变量更改

Clarifying AWS tutorial for User identification - variables change

正在学习本教程:http://docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html 我发现如下提示:

要使用此身份提供程序,您必须将其传递到 CognitoCachingCredentialsProvider。这是一个例子:

DeveloperAuthenticationProvider developerProvider = new DeveloperAuthenticationProvider( null, "IDENTITYPOOLID", context, Regions.USEAST1);
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider( context, developerProvider, Regions.USEAST1);

我应该将它放在上面提到的 class 中还是转到 CognitoCachingCredentialsProvider?

谢谢!

您必须在 DeveloperAuthenticationProvider class 中提及而不是缓存提供商。

您应该将该代码放在实例化凭据提供程序的任何位置(理想情况下应该是单例)。至于区域,您可以尝试使用 Regions.US_EAST_1 而不是 Regions.USEAST1 吗?

如果您好奇,Cognito sample app 有一个示例实现。