Welcome!

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

Reply
New Contributor
Posts: 8
Registered: ‎06-15-2010
My Device: Bold 97000
My Carrier: Telus

Widget:: XmlHttpRequest Authentication Problems

Hi,

 

We are developing a BlackBerry Widget that uses web-services. The calls to the webservices are done with  XMLHttpRequest and Basic Authentication.

 

In the simulator, we are able to get a success response, but on the device we get an error 401.  Here's an example of the code:

 

    var request2 = new XMLHttpRequest();
    request2.open("POST",url, true);
    request2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    request2.setRequestHeader("Content-length", postData.length);
    request2.setRequestHeader("Authorization","Basic hash");
    request2.setRequestHeader("Connection", "close");
    request2.onreadystatechange = function() {
        if (this.readyState == 4) {
            alert(this.readyState + ": " + this.status);
        }
    };
     request2.send(postData);

 

The data sent is small (less than 1KB).

 

It sound similar to other posts on this forum.  Are there any fixes or workarounds?  Any help would be appreciated.  Thanks

 

AJ

New Contributor
Posts: 8
Registered: ‎06-15-2010
My Device: Bold 97000
My Carrier: Telus

Re: Widget:: XmlHttpRequest Authentication Problems

Has anyone had similar issues?    Any advice would be appreciated.

 

New Contributor
Posts: 8
Registered: ‎06-15-2010
My Device: Bold 97000
My Carrier: Telus

Re: Widget:: XmlHttpRequest Authentication Problems

Any thoughts or ideas?  Is this a bug?

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Widget:: XmlHttpRequest Authentication Problems

Hi ajgogo,

 

We currently don't have the support for challenge response authentication in BlackBerry Widgets.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 185
Registered: ‎08-17-2008
My Device: Red BlackBerry Z10
My Carrier: Vodafone

Re: Widget:: XmlHttpRequest Authentication Problems

Here i have problems too with AJAX request with Basic Authentication.

 

It is not supported yet in SDK 2.3 for Smartphone?

 

same code works fine with PlayBook SDK 2.2

Josep Maria