了解认知身份 [英] Understanding Cognito Identities

查看:79
本文介绍了了解认知身份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经徘徊了几个小时,试图了解移动应用程序中的Cognito和身份管理。我是移动应用开发的新手。我之前开发过一款移动应用,但从未开发过一款带有后端的应用。因此,现在我正打算尝试使用AWS。

I've been stumbling around for a few hours trying to understand Cognito and identity management in a mobile app. I'm relatively new to mobile app development. I've made a mobile app before, but never one with a back-end. so now I'm playing around with AWS intending to try just that.

我想确保可以唯一标识使用我的应用程序的每个用户,以便我可以存储他们提交给与其关联的服务器的内容。但我也希望其他用户能够看到他们提交的内容。我还没有决定采用哪种数据存储机制(亚马逊似乎提供了一些),但是无论它是什么,都必须是无限期的免费服务,因为我不打算在此应用上花费(或赚钱)任何钱。

I want to make sure that each user using my app can be uniquely identified so that I can store content that they submit to the server associated with them. But I also want other users to be able to see their submitted content. I haven't decided on a data storage mechanism yet (Amazon seems to offer a few), but whatever it is will have to be an indefinitely free service since I'm not planning on spending (or earning) any money on this app.

让我感到困惑的部分原因是,需要使用我想与联邦身份一起使用的任何服务来创建App ID。我开始怀疑我会混淆多种身份。该应用是否具有独立于用户身份的自己的身份?我没想到只需要创建Google和Amazon应用程序ID即可允许用户使用其Google或Amazon帐户登录到我的应用程序。我怀疑我理解API错误,并且很难找到适用于Xamarin的适用示例代码。

Part of what is confusing me is the need to create App IDs with whatever service I wanted to use with federated identities. I am starting to suspect there are multiple kinds of identities that I'm getting confused. Does the App have its own identity independent of a user's identity? I didn't expect to have to create Google and Amazon App IDs just to allow users to log into my app using their Google or Amazon accounts. I suspect I'm understanding the API wrong, and I'm having a really hard time finding applicable sample code usable from Xamarin.

我有这么多代码(唯一标识符) x'd):

I have this much code (unique identifier x'd out):

CognitoAWSCredentials credentials = new CognitoAWSCredentials(
    "us-east-2:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Identity pool ID
    RegionEndpoint.USEast2 // Region
);

这似乎在调试器中运行,至少没有引发异常,但是我不清楚它给了我什么。我怀疑此凭据对象可以在用户重启设备后唯一标识用户,并在第二天再次启动该应用。为此,我怀疑我还需要一些东西,而且不清楚。要为用户获取唯一标识符并将其与他们的内容存储起来以与他们相关联,下一步是什么?

And that seemed to run (in a debugger) without throwing an exception at least, but I'm not clear what it has given me. I'm doubting that this credentials object uniquely identifies the user after they might reboot their device, and start the app again the next day. For that I suspect I need something more, and I'm not clear what. What's the next simplest step to get a unique identifier for a user which I can store along with their content to associate it with them?

推荐答案

您是要让用户使用第三方身份还是要提供用户自己的身份?对于联合身份(第三方),您需要提供在Cognito中创建的身份池ID,以标识联合身份提供者。对于您在Cognito中的身份,您可以创建用户池,其中也包含一个ID。

Are you set on having users use third part identity or do you want to provide user's their own identity? For federated identities (3rd party) you need to provide an Identity Pool ID which is created in Cognito to identify the federated identity provider. For your own identities in Cognito you create User Pools which also have an ID.

如果要提供用户登录和注册,则要使用Cognito身份而不是联盟身份。以下链接对此提供了一些很好的参考-

If you want to provide user sign-in and sign-up you want to use Cognito identities and not federated identities. The link below has some good references regarding this -

https://aws.amazon.com/cognito/dev-resources/

这篇关于了解认知身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆