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
Highlighted
Developer
Posts: 20
Registered: ‎08-24-2012
My Device: Curve 9300
My Carrier: Rogers
Accepted Solution

Popup on XMLHttpRequest for "requires authentication" - Webworks on BB OS 5.0+

[ Edited ]

Hello,

 

In my Webworks app for OS 5+, I make several XMLHttpRequest calls to my server to login, pull down info, etc.  The usual.

 

Occasionally, and with no apparent pattern (i.e. not always the first time after starting app. Not only specific requests. ) I will get a popup with something along the lines of "This page requires authentication, please enter username and password" and then asks for Domain, username, and password.  

 

However, I can just back out and try again and it will work fine.

 

Anyone have any experience with this and know of what is possibly causing it or a fix?

 

Or just any guesses?  I'm stumped at the moment.

 

This does seem to only happen on actual devices though.  I haven't seen it in Ripple (not expected) or the emulator.  Unfortunately, my Curve does not seem to let me debug it so I have no info other than the dialog that pops up.

 

Thanks,

Rob.

Developer
Posts: 20
Registered: ‎08-24-2012
My Device: Curve 9300
My Carrier: Rogers

Re: Popup on XMLHttpRequest for "requires authentication" - Webworks on BB OS 5.0+

More info:

 

It's actually "requires authentication" not "requires authorization".  I've changed the OP to the correct term.

 

More research makes me think it is from a 401 when my session expires.  At least I can force it by deleting the session. 

 

So then how can I have Webworks leave the handling of the 401 to me as I'd prefer to use my own login page and messages?  Particularly since the default seems to want to use basic http auth, which we aren't using.

Developer
Posts: 20
Registered: ‎08-24-2012
My Device: Curve 9300
My Carrier: Rogers

Re: Popup on XMLHttpRequest for "requires authentication" - Webworks on BB OS 5.0+

OK, turns out it was a 401.  Doh.  And the solution for it is here: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Suppressing-HTTP-401-Authenticat...

New Developer
Posts: 8
Registered: ‎08-04-2014
My Device: BlackBerry Q10/Z10
My Carrier: Telus

Re: Popup on XMLHttpRequest for "requires authentication" - Webworks on BB OS 5.0+

Any chance you might know how to solve same problem this for BB10?

Developer
Posts: 20
Registered: ‎08-24-2012
My Device: Curve 9300
My Carrier: Rogers

Re: Popup on XMLHttpRequest for "requires authentication" - Webworks on BB OS 5.0+

Sorry.  Only had the problem on BBOS.  Haven't run into it on BB10.

New Developer
Posts: 8
Registered: ‎08-04-2014
My Device: BlackBerry Q10/Z10
My Carrier: Telus

Re: Popup on XMLHttpRequest for "requires authentication" - Webworks on BB OS 5.0+

No problem. We solved it on the server side by sending a 403 header instead of a 401 header. Cheers.