Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

MQTT send failed, not authorized #13

Closed
FlorisColpaert opened this issue May 14, 2018 · 10 comments
Closed

MQTT send failed, not authorized #13

FlorisColpaert opened this issue May 14, 2018 · 10 comments

Comments

@FlorisColpaert
Copy link

Hey, I tried to send data to a device. I get the message not authorized. (I'm using the ESP32 and on Ubuntu with esp32makearduino).

Now I noticed in the error logging, the date time with your timer was incorrect. Could this be an issue? I allready runned the code with ESP-IDF and ESP32-Azure IOT. Then it works with the same connecting string. Do I have to set your time.h used library?

K.R.

Floris

-- or logger --
2018/05/14 13:27:20 FanController Warn Fan stopped, rebooting the motor

2018/05/14 13:27:24 FlowRateCalculator Warn interpolation failed

-- your code --

Info: IoT Hub SDK for C, version 1.1.29

IoTHubClient accepted the message for delivery

Error: Time:Thu Jan 1 00:01:01 1970 File:./libs/azure-iot_arduino/src/sdk/iothubtransport_mqtt_common.c Func:mqtt_operation_complete_callback Line:1552 Connection Not Accepted: 0x5: Not Authorized

Error: Time:Thu Jan 1 00:01:02 1970 File:./libs/azure-iot_arduino/src/sdk/iothubtransport_mqtt_common.c Func:mqtt_operation_complete_callback Line:1552 Connection Not Accepted: 0x5: Not Authorized

Error: Time:Thu Jan 1 00:01:02 1970 File:./libs/azure-iot-arduino-protocol-mqtt/src/azure_umqtt_c/mqtt_client.c Func:sendPacketItem Line:332 141: Failure sending control packet data

Error: Time:Thu Jan 1 00:01:02 1970 File:./libs/azure-iot-arduino-protocol-mqtt/src/azure_umqtt_c/mqtt_client.c Func:mqtt_client_disconnect Line:1176 Error: mqtt_client_disconnect send failed

Message Id: 0 Received.

Result Call Back Called! Result is: IOTHUB_CLIENT_CONFIRMATION_BECAUSE_DESTROY

@AlexeyKopchak
Copy link

Hello. Have same problem, try to fix it 2 days in a row. The only thing I found out - its wrong fetched time (you can see in Thu Jan 1 00:01:01 1970). And i don't know how to fix it.

Work on Arduino 1.8.5
ESP8266 lib - 2.4.0 (very big chance problem is here)
Azure lib on last version on June 13 (1.0.44).

I think if we can get correct time - we can do authorization

Do any have solution to this problem ?

@FlorisColpaert
Copy link
Author

FlorisColpaert commented Jun 13, 2018

I did fix this issue by using the arduino libs to get date time of the ntp server but I should look up where in the code. This is a sub task at or company, not urgent. Try this: espressif/arduino-esp32#935.

@AlexeyKopchak
Copy link

@FlorisColpaert ty for reply. I'm maybe trying ESP32, but i have ESP8266 and it will be great to find solution for it.

@FlorisColpaert
Copy link
Author

FlorisColpaert commented Jun 13, 2018

@AlexeyKopchak
Copy link

@FlorisColpaert if it's work - where i need to put correct time on Azure mqtt lib ?
I think this will not help to send correct message using MQTT to Azure IoT Hub.

@AlexeyKopchak
Copy link

I find solution to my problem: i change wi-fi point (i use work free wi-fi and i dont know it configuration but im trying to get it), i use android phone as router (3G) and it start work, i get correct time and my packed now valid. If i have new detail - i report here.

@AlexeyKopchak
Copy link

UPD. Time works only on 2.3.0 version of Arduino ESP8266 lib

@anmalkov
Copy link

I solved that by putting the delay(1000); after configTime(...).
ESP8266 lib 2.4.2
Azure lib 1.0.45

@sw-tt-chandershekharsuthar
Copy link

sw-tt-chandershekharsuthar commented Feb 4, 2019

hello @AlexeyKopchak @FlorisColpaert

I'm trying to connect ESP8266 with Azure cloud as per given Example
But getting Error like " Connection Not Accepted: 0x5: Not Authorized "

Edit my wifi routers connection and "HostName=<host_name>;DeviceId=<device_id>;SharedAccessKey=<device_key>"
ArduinoIDE 1.6.5 (window10)
ESP8266 lib 2.4.2
Azure lib 1.0.45

hey @anmalkov
where is that ... configTime(...).
you said
I solved that by putting the delay(1000); after configTime(...).

@jbobotek
Copy link
Contributor

Issue appears resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants