I have some problem about connection between mosquito client (MQTT Client) and AWS IoT which I try to use it to be a MQTT Broker.
According to a previous problem (https://repost.aws/questions/QUhrT5J_mgTtOVwmoktnxm7g/my-token-signature-in-aws-iot-test-invoke-authorizer-always-mismatch) about custom authentication for AWS IoT which it’s was solved already and I can connected to AWS IoT by HTTPS but my target is use AWS IoT as MQTT Broker which client can connect with username and password. So this is a next step that I have to try to connect by MQTT client like as mosquito client.
I had found a developing guide like this :
Creating and managing custom authorizers - AWS IoT Core (amazon.com)
Connecting to AWS IoT Core by using custom authentication - AWS IoT Core (amazon.com)
So I try to change some code in index.js follow that guide.
and after that I try to test by
- aws iot test-invoke-authorizer --authorizer-name my-new-authorizer --mqtt-context "{"username": "USER_NAME", "password": "dGVzdA==", "clientId":"CLIENT_NAME"}" –debug
And I got this
- botocore.errorfactory.InvalidRequestException: An error occurred (InvalidRequestException) when calling the TestInvokeAuthorizer operation: None
It has no any log in Log groups too. So I have no idea what is my mistake.
And I had also try from mosquito client which I got this
{
"timestamp": "2023-02-07 10:29:42.083",
"logLevel": "ERROR",
"traceId": "7dbeef79-b54d-b695-10e3-106fac44e397",
"accountId": "980736740464",
"status": "Failure",
"eventType": "Connect",
"protocol": "MQTT",
"clientId": "browser",
"principalId": "null",
"sourceIp": "171.6.98.137",
"sourcePort": 38730,
"reason": "AUTHORIZATION_FAILURE",
"details": "Authorization Failure"
}
In Log groups which it has nothing in log of lamda too.
It’s look like my authorizer not support mqtt protocol then it’s not allow to pass it to lamda but I’m really unsure.
I have really no idea about them.
do anyone have an idea about it?
Thank You