如何使用Cognito在Android中更新用户池属性?

huangapple go评论72阅读模式
英文:

How do I use Cognito to update user pool attributes with android?

问题

我正在制作一个Android应用程序,并使用Amplify框架在我的用户池中创建了一个用户。Amplify的文档表示,目前尚未构建用于获取/设置属性的调用,所以我想我需要直接使用Cognito。

现在,我想在用户注册后设置属性,例如名称。目前我有以下代码,但我不确定接下来该怎么做。

CognitoUserAttributes attributes = new CognitoUserAttributes();
attributes.addAttribute("testAttribute", "testValue");

此外,我正在努力弄清楚如何在Android中使用Cognito,我能找到的唯一文档是这个链接:https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/index-all.html

英文:

I'm making an android app and have created a user in my user pool with the Amplify framework. The documenation for amplify says that making calls to get/set attributes isn't built yet, so I guess I need to use cognito directly.
I now want to set attributes such as name once the user signs up.

Right now I have this code, but I'm not sure what to do from here.

    CognitoUserAttributes attributes = new CognitoUserAttributes();
    attributes.addAttribute("testAttribute", "testValue");

Also I'm struggling to figure out how to use cognito in android, the only documentation I can find is this: https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/index-all.html

答案1

得分: 1

这个功能目前还没有在Amplify for Android中实现,但计划在不久的将来完成,正如此文档中所述。请定期查看文档以获取可用性更新。

与此同时,您仍然可以使用Amplify。只需通过认证逃生口访问底层的AWSMobileClient,它支持传递自定义属性。有关如何确切使用AWSMobileClient的详细信息,请参阅此文档

英文:

This functionality has not yet been implemented in Amplify for Android but is scheduled to be finished in the near future, as noted in this documentation. Please check back to the documentation for updates on availability.

In the meantime though, you can still use Amplify. Just access the underlying AWSMobileClient through the authentication escape hatch, which does support passing custom attributes. See this documentation for more details on how exactly to use AWSMobileClient.

huangapple
  • 本文由 发表于 2020年8月13日 18:19:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/63392996.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定