适用于 Xamarin 的 AWS Cognito

AWS Cognito for Xamarin

我正在尝试按照 this 指南使用 AWS Cognito 和 AWS 用户池创建新用户、更改密码等。我似乎无法为 Android/iOS 找到合适的 Xamarin SDK。有吗?

更具体地说,我在创建 Cognito 用户池对象时遇到了问题。在我链接的示例中,他们有这个:

CognitoUserPool userPool = new CognitoUserPool(context, userPoolId, clientId, clientSecret);

// user pool can also be created with client app configuration:
CognitoUserPool userPool = new CognitoUserPool(context, userPoolId, clientId, clientSecret, clientConfiguration);

好像没有CognitoUserPoolclass。我在 AWSSDK.CognitoIdentity 库中找不到任何类似或具有类似构造函数或任何东西的东西。我是不是遗漏了什么或者这还不支持?

我也无法从此处显示的 Register a new user 示例代码中找到与 SignUpHandler class 类似的内容:

// create a handler for registration 
SignUpHandler handler = new SignUpHandler() {
    @Override
    public void onSuccess(CognitoUser user, boolean signUpConfirmation) {
        // The sign up was successful, "user" is a CognitoUser object of the user who was signed up.

        // "signUpConfirmation" will indicate if user is already confirmed.
    }

    @override
    public void onFailure(Exception exception) {
        // Sign up failed, code check the exception for cause and perform remedial actions.
    }
}

Amazon 通过 NuGet 提供了 C#/.NET SDK,这将是最新版本并且应该提供您需要的功能。

您可以在这里找到这个包:https://www.nuget.org/packages/AWSSDK.CognitoIdentity/

您也可以通过 NuGet 控制台下载 NuGet:

Install-Package AWSSDK.CognitoIdentity -Version 3.1.1.2

最后,可以通过 Xamarin Studio 中的 NuGet 包添加,方法是搜索:

AWSSDK.CognitoIdentity

谢谢!

我只是 answered 另一个 post 中的类似问题。

简短的回答,目前,Xamarin/Unity SDK 不支持 Cognito 用户池客户端 SDK。 API 形状可用于直接与服务交互,但除了 Android、iOS 之外,您不会在任何其他 SDK 中找到像 CognitoUserPoolCognitoUser 这样的助手和 JavaScript.

我知道这个问题/答案很旧,但我的搜索把我带到这里,希望我能帮助别人。

您现在可以通过安装 AWSSDK.Extensions.CognitoAuthentication Nuget 包在 AWS .Net SDK 中使用用户池。

Nuget:https://www.nuget.org/packages/AWSSDK.Extensions.CognitoAuthentication

以下是将 AWS Cognito 与 Xamarin Forms 结合使用的示例:

https://github.com/curtisshipley/CognitoForms