'Authentication failed' message but credentials are valid

If you can connect using other clients, then this is very likely an issue with how you use the library, not in Openfire.

Every XMPP server has a domain, even if you do not configure a public “nice” one. It is important to define that correctly when setting things up. Look at the first page of the admin console of Openfire: it will show you what the domain name is that was used to configure Openfire. You need to use this domain value when connecting with a client.