Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Posts: 137
Registered: ‎12-22-2010
My Device: Curve 8520
My Carrier: Software Developer

Suppress login dialog after bad authentication



I have some code like this to call a username/password protected api.


            url: myprotectedurl + "/profile",
            type: "GET",
            success: function (result) {
                // magic stuff!
            beforeSend: function (xhr) {
                xhr.setRequestHeader("Authorization", "Basic " + myBase64codedUsernameAndPassword);
            error: function (jqXHR, textStatus, errorThrown) {
                var errortext;

                switch (jqXHR.status) {
                    case 401:
                        errortext = "Invalid username/password combination.";
                    case 404:
                        errortext = "Cannot resolve service address. Check your internet connection and make sure the latest version of this app is installed.";
                    case 503:
                        errortext = "The service is down for maintenance. Please try again later.";
                        errortext = "The host isn't available. Check your internet connection.";

                $('#pageLogin .error').html(errortext).show();

 It works nice on playbook! When the username/password is wrong the error message is shown. Now I want to port this to a blackberry smartphone. If the username/password is wrong there is a popup to enter username, domain and password ?!? after "cancel" I get the correct message.


Can I suppress this issue?

Posts: 37
Registered: ‎01-08-2010
My Device: Various
My Carrier: Rogers

Re: Suppress login dialog after bad authentication

In BB5/6/7 WebWorks handles authentication in the framework. If you go to here you will see that the framework triggers the dialog. If you have no need for the built-in dialog you can always modify the WebWorks framework to suit your needs. Have a look in your install directory and you will see the full source which gets included in each application at the time of packaging.


Please note: Making modifications to the framework are not supported, but with a little knowledge you should be able make the required changes.


On tablet, the authentication mechanism is not handled by the WebWorks framework, so the behaviours may be a little different.