Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uMQTT Broker Arduino IDE how to set user and Password?? #55

Open
OliverESP opened this issue May 2, 2021 · 4 comments
Open

uMQTT Broker Arduino IDE how to set user and Password?? #55

OliverESP opened this issue May 2, 2021 · 4 comments

Comments

@OliverESP
Copy link

Hi,

how can i set a User and Password after myBroker.init();

like myBroker.setUserPwd("Name", "Password");

Thanks for support

Greets Olli

@FernandoGarcia
Copy link

Hi!

I was trying an adaptation from this answer but I have a strange behaviour.

Using this piece of code the authentication works but if client change the password the broker won't accept the connection even with right password. However after an ESP reset the broker allows client connection.

    virtual bool onAuth(String username, String password, String client_id)
    {
      Serial.println("\nUsername:" + username + "\nPassword:" + password + "\nID: " + client_id);

      if ((String)username == "myUser" &&  (String)password == "myPass" )
      {
        return true;
      }
      else
      {
        return false;
      }
    }

Could you @puskyer tell us if you have solved your problem?

Best regards.

@puskyer
Copy link

puskyer commented Jun 13, 2021

Hello @FernandoGarcia

Sorry I abandoned my project a few years ago, since then I no longer have the code, so I am not sure if it was solved in any of my changes.

Cheers,

@FernandoGarcia
Copy link

Ok, thanks!

@puskyer
Copy link

puskyer commented Jun 13, 2021

@FernandoGarcia

FYI, you may wish to look at the esp-mqtt code.
Mqtt.c file, maybe something there does not get initialized after a change, but does during a restart.

Good luck,

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

No branches or pull requests

3 participants