问题描述
我是学习AWS的新手,我试图弄清楚我的用例是否可行。我想创建一个移动应用程序,用户可以登录(电子邮件/ facebook / google等),然后在AWS IoT上订阅一些MQTT主题,以接收园艺系统的实时传感器数据。 AWS上有很多教程,向您展示如何执行
(主要示例:)
I'm new to learning AWS and I'm trying to figure out if my use-case is possible. I want to create a mobile app where the user can login (email/facebook/google etc.) and then subscribe to a few MQTT topics on aws IoT to receive realtime sensor data for a gardening system. There are many tutorials on AWS that show you how to do this (prime example: https://github.com/awslabs/aws-sdk-android-samples/blob/master/AndroidPubSub/README.md)
,但所有这些都需要您下载证书,在代码/密钥库本身中插入应用程序ID,秘密密钥等。我真的很想避免所有这些情况,只需要使用登录名作为订阅这些主题所需的所有授权即可。
but all of them require you to download certificates, insert app IDs, secret keys etc. in the code/keystore itself. I'd really like to avoid all of this and just use the login as all the authorization you would need to subscribe to these topics.
这可能吗?还是我需要构建一些自定义系统?
is this possible? or do I need to build some custom system?
推荐答案
简短的回答,是的,有可能。为此,您应该执行以下操作:
Short answer, Yes, it is possible. To do that you should do the following:
-
创建Cognito 用户池。下一步将使用
用户池ID
和App客户端ID
。您可以在。
Create Cognito user pool.
User Pool ID
andApp client id
will be used in the next step. You can find more information here.
创建Cognito 身份池。在身份验证提供程序
下,您应提供用户池ID
和 App客户端ID
,更多信息,请。
Last step would be using aws-iot-sdk
for your App along with those credentials to publish and subscribe to your IoT topics. You can find more information about aws-iot-sdk
here.
这篇关于使用cognito登录而不是证书来认证和订阅AWS IoT MQTT主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!