SASL authentication using mechanism DIGEST fails


username

I am seeing this error when using Smack in a chat app.

When I try to log in to my app, it fails every time.

Here is my logCat.

Xmpp==>SASL authentication failed using mechanism DIGEST-MD5: 02-15 10:55:00.385: E/Oxygen(4187): at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:341)
02-15 10:55:00.385: E/Oxygen(4187): at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:242)
02-15 10:55:00.385: E/Oxygen(4187): at org.jivesoftware.smack.Connection.login(Connection.java:371)
02-15 10:55:00.385: E/Oxygen(4187): at free_call.chat.oxygen.util.XmppTool.login(XmppTool.java:434)
02-15 10:55:00.385: E/Oxygen(4187): at free_call.chat.oxygen.PresenceService.userLogin(PresenceService.java:818)
02-15 10:55:00.385: E/Oxygen(4187): at free_call.chat.oxygen.PresenceService.xxampServerLogin(PresenceService.java:728)
02-15 10:55:00.385: E/Oxygen(4187): at free_call.chat.oxygen.PresenceService$xampRegistation.doInBackground(PresenceService.java:870)
02-15 10:55:00.385: E/Oxygen(4187): at free_call.chat.oxygen.PresenceService$xampRegistation.doInBackground(PresenceService.java:1)
02-15 10:55:00.385: E/Oxygen(4187): at android.os.AsyncTask$2.call(AsyncTask.java:292)
02-15 10:55:00.385: E/Oxygen(4187): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
02-15 10:55:00.385: E/Oxygen(4187): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
02-15 10:55:00.385: E/Oxygen(4187): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-15 10:55:00.385: E/Oxygen(4187): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-15 10:55:00.385: E/Oxygen(4187): at java.lang.Thread.run(Thread.java:818)
02-15 10:55:00.385: E/xxamp status1(4187): xxamp server not connected
Muhammad Nasir Rajput

I use the code below and it worked for me.

    ConnectionConfiguration config = new ConnectionConfiguration("your_server", port_no);
config.setSASLAuthenticationEnabled(true);
config.setCompressionEnabled(true);
config.setSecurityMode(SecurityMode.enabled);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    config.setTruststoreType("AndroidCAStore");
    config.setTruststorePassword(null);
    config.setTruststorePath(null);
} else {
    config.setTruststoreType("BKS");
    String path = System.getProperty("javax.net.ssl.trustStore");
    if (path == null)
        path = System.getProperty("java.home") + File.separator + "etc"
            + File.separator + "security" + File.separator
            + "cacerts.bks";
    config.setTruststorePath(path);
}

Related


Spring-boot Digest authentication fails with digest filter

SUBHODiP Ghosh I am new to this technology. I am trying to implement digest authentication for my Springboot application. I'm getting the following error when trying to call my app: No PasswordEncoder *Mapped for id \"null\"","path":"/countryId/"} *Close conne

Spring-boot Digest authentication fails with digest filter

SUBHODiP Ghosh I am new to this technology. I am trying to implement digest authentication for my Springboot application. I'm getting the following error when trying to call my app: No PasswordEncoder *Mapped for id \"null\"","path":"/countryId/"} *Close conne

Spring-boot Digest authentication fails with digest filter

SUBHODiP Ghosh I am new to this technology. I am trying to implement digest authentication for my Springboot application. I'm getting the following error when trying to call my app: No PasswordEncoder *Mapped for id \"null\"","path":"/countryId/"} *Close conne

Digest authentication in Android using HttpURLConnection

Springrbua As all the questions already said, I'm trying to do digest authentication in android. Until now, I've been using DefaultHttpClientand authentication methods (using UsernamePasswordCredentialsetc.), but they are deprecated since Android 5 and will be

Digest authentication in Android using HttpURLConnection

Springrbua As all the questions already said, I'm trying to do digest authentication in android. Until now, I've been using DefaultHttpClientand authentication methods (using UsernamePasswordCredentialsetc.), but they are deprecated since Android 5 and will be

Client Digest Authentication using POCO

Marek I am using POCO for some service clients. Clients should log in using digest authentication. The POCO documentation claims to support digest authentication . This is a utility class for using HTTP authentication (basic or digest ) in the HTTPRequest obje

Digest authentication in Android using HttpURLConnection

Springrbua As all the questions already said, I'm trying to do digest authentication in android. Until now, I've been using DefaultHttpClientand authentication methods (using UsernamePasswordCredentialsetc.), but they are deprecated since Android 5 and will be

Client Digest Authentication using POCO

Marek I am using POCO for some service clients. Clients should log in using digest authentication. The POCO documentation claims to support digest authentication . This is a utility class for using HTTP authentication (basic or digest ) in the HTTPRequest obje

Traefik: Unable to log in to service using digest authentication

Bastian I'm trying to use Traefik to reverse convert a proxy to a service that uses digest authentication. When I access the service directly through its port after exposing it in docker-compose, it works fine, but when I access the service through Traefik, th

Traefik: Unable to log in to service using digest authentication

Bastian I'm trying to use Traefik to reverse convert a proxy to a service that uses digest authentication. When I access the service directly through its port after exposing it in docker-compose, it works fine, but when I access the service through Traefik, th

How to publish a message with Digest Authentication using Node?

Dave Cassel I'm trying to publish a message to a MarkLogic application server with digest security using Node. The equivalent curl request works fine: curl -v -X POST --anyauth -u admin:admin --header "Content-Type:application/json" \ -d '{"user-name":"joe",

How to publish a message with Digest Authentication using Node?

Dave Cassel I'm trying to publish a message to a MarkLogic application server with digest security using Node. The equivalent curl request works fine: curl -v -X POST --anyauth -u admin:admin --header "Content-Type:application/json" \ -d '{"user-name":"joe",

Get username on server using Digest Authentication (Perl)

Hubert Schölnast I have a web server and on this server I serve some restricted content. Users must log in with digest authentication. This is nice because all users have seen the same content so far. But now I want to write a cgi script in Perl that needs to

Traefik: Unable to log in to service using digest authentication

Bastian I'm trying to use Traefik to reverse convert a proxy to a service that uses digest authentication. When I access the service directly through its port after exposing it in docker-compose, it works fine, but when I access the service through Traefik, th