# HiveMQ Cloud server rejects connection to ESP32

**URL:** <https://community.hivemq.com/t/hivemq-cloud-server-rejects-connection-to-esp32/889>\
**Category:** HiveMQ Cloud\
**Created:** [December 13, 2021, 5:39pm UTC](https://community.hivemq.com/t/hivemq-cloud-server-rejects-connection-to-esp32/889 "2021-12-13T17:39:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![userohf](https://avatars.discourse-cdn.com/v4/letter/u/48db29/32.png) [@userohf](https://community.hivemq.com/u/userohf)\
**Post date:** [December 13, 2021, 5:39pm UTC](https://community.hivemq.com/t/hivemq-cloud-server-rejects-connection-to-esp32/889/1 "2021-12-13T17:39:29Z")

</div>

Hi, I am trying to connect to HiveMQ Cloud with an ESP32, but the mqtt server rejects the connection with the message “rc-2”. I use the WIFIClientSecure library. I need your help. Thank you very much.

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [December 14, 2021, 8:28am UTC](https://community.hivemq.com/t/hivemq-cloud-server-rejects-connection-to-esp32/889/2 "2021-12-14T08:28:38Z")

</div>

Hi Omar,

Welcome to the HiveMQ Community!

You indicated that the HiveMQ Cloud broker has rejected the connection with the message “rc-2”. According to the MQTT specification, CONNACK return code 2 means “0x02 Connection Refused, identifier rejected” i.e. “The Client identifier is correct UTF-8 but not allowed by the Server”.

First step hence is to check what is the `client id` that your device is using.

More info on the return codes:

1. [MQTT Specification](https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718035)
2. [MQTT Client and Broker and MQTT Server and Connection Establishment Explained - MQTT Essentials: Part 3](https://www.hivemq.com/blog/mqtt-essentials-part-3-client-broker-connection-establishment/)

Kind regards,  
Dasha from HiveMQ Team
