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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

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.