jpmens / mosquitto-auth-plug

Authentication plugin for Mosquitto with multiple back-ends (MySQL, Redis, CDB, SQLite3)
Other
825 stars 496 forks source link

authentication not working #340

Closed pokal4u closed 6 years ago

pokal4u commented 6 years ago

Hi,

I am trying to connect mqtt using with authentication, getting error like "AMQJS0008I Socket closed.". It was working without authentication.

My code:

var client = new Paho.MQTT.Client("domain", port, "myClientId" + new Date().getTime()); client.connect({userName:'srinivas',password:'123456',onSuccess:onConnect,onFailure:doFail,useSSL:true,cleanSession:false});

mosquittio config file:

allow_anonymous false

MONGODB: auth_opt_backends mongo auth_plugin auth-plug.so auth_opt_mongo_uri mongodb://localhost:port auth_opt_mongo_user username auth_opt_mongo_password password auth_opt_mongo_database db auth_opt_mongo_collection_users users auth_opt_mongo_collection_topics topics

MYSQL: auth_opt_backends mysql auth_plugin auth-plug.so auth_opt_host localhost auth_opt_port port auth_opt_dbname db auth_opt_user username auth_opt_pass password auth_opt_userquery SELECT pw FROM users WHERE username = '%s' auth_opt_superquery SELECT COUNT(*) FROM users WHERE username = '%s' AND super = 1

Please help me.

Thanks

jpmens commented 6 years ago

Which steps have you attempted to get this going?