หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page
Help Center/ IoT/ API Reference/ MQTT Interface Reference/ API Description/ MQTT Connection Authentication Through CONNECT Messages

MQTT Connection Authentication Through CONNECT Messages

Updated on 2022-02-24 GMT+08:00

Interface Function

The IoT platform provides the CONNECT message interface for MQTT devices to access the IoT platform. For details about the API specifications, see mqtt-v3.1.1-os.pdf. After the device is authenticated, the MQTT connection between the device and the IoT platform is established.

NOTE:

The IoT platform supports only MQTTS access. When a device establishes an MQTT connection to the IoT platform through the CONNECT message interface, the TLS certificate must be carried. Visit Obtaining Development Resources to obtain the TLS certificate from the AgentLite directory.

Parameters

Parameter

Mandatory or Optional

Type

Description

clientId

Mandatory

String(256)

The value of this parameter consists of device ID, authentication type, password signature type, and timestamp, which are separated by underscores (_). The device ID is deviceId returned after the device is registered successfully when the device uses deviceId to access the IoT platform. The value can also be nodeId entered during device registration with the IoT platform when the device uses nodeId to access the IoT platform.

  • authenticationType: This 1-byte parameter has three value options, 0, 1, and 2. 0 indicates that the device uses deviceId to access the IoT platform. 2 indicates that the device uses nodeId to access the IoT platform. 1 indicates that the one-model-one-secret mode is used for device access.
  • passwordSignatureType: The length is 1 byte, and the value can be 0 or 1.
    • 0 indicates that the timestamp is not verified using the HMACSHA256 algorithm.
    • 1 indicates that the timestamp is verified using the HMACSHA256 algorithm.
  • timestamp: indicates the UTC time when the device connects to the IoT platform. The format is YYYYMMDDHH. For example, if the UTC time is 2018/7/24 17:56:20, the timestamp is 2018072417.

username

Mandatory

String(256)

  • For one-device-one-secret devices, the value of this parameter is deviceId returned after the device is successfully registered when the device uses deviceId to access the IoT platform. The value can also be nodeId entered during device registration with the IoT platform when the device uses nodeId to access the IoT platform.

password

Mandatory

String(256)

The value of this parameter is the value of the device secret encrypted by using the HMACSHA256 algorithm with the timestamp as the key.

The device secret is returned by the IoT platform after the successful device registration.

The IoT platform performs authentication based on the CONNECT message of the MQTT protocol. The information contained in clientId must be intact. When receiving a CONNECT message, the IoT platform checks the authentication type and password digest algorithm of the device.

  • When the timestamp is verified using the HMACSHA256 algorithm, the IoT platform checks whether the message timestamp is consistent with the platform time and then checks whether the secret is correct.
  • The timestamp must be contained in the CONNECT message even when the timestamp is not verified using the HMACSHA256 algorithm, but the IoT platform does not check whether the time is correct. In this case, only the secret is checked.

If the authentication fails, the IoT platform returns an error message and automatically disconnects the MQTT link.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback