emqtt icon indicating copy to clipboard operation
emqtt copied to clipboard

Ability to refresh mqtt password at every reconnection

Open leandronsp opened this issue 6 years ago • 3 comments

Hi, we have a scenario where every time we generate a password to the MQTT, this password may have some security constraints, i.e expiration time, depending on the MQTT module implementation.

Sometimes the tcp connection may be closed or the emqttc process might fail for any reason, then we'd like to use the same process to retry over again but using a different password.

This patch adds the ability to send a password_refresher to the mqtt connection opts, a simple function which will be called at every connect/reconnect.

Usage

PasswordRefresher = fun() -> <<"logic to generate a new password">> end,
{ok, C} = emqttc:start_link([{host, "localhost"}, {password_refresher, PasswordRefresher}]).

leandronsp avatar Sep 24 '18 13:09 leandronsp

cc @emqplus

leandronsp avatar Sep 25 '18 09:09 leandronsp

up @emqplus

leandronsp avatar Sep 27 '18 10:09 leandronsp

up @emqplus

leandronsp avatar Dec 20 '18 10:12 leandronsp