0

In an application where I am making cross-domain JSONP requests (using jQuery), when the browser makes the first jsonp request, it pops up a dialog for basic authentication, because that is what the target server requires. I would instead like to trap the event and bring up a dialog with a logon page from the server hosting the resource to establish authentication. How can I do this?

mydoghasworms
  • 18,233
  • 11
  • 61
  • 95

3 Answers3

0

I think it is not possible, only option is to disable basic authentication and for end users, shouldn't that be disabled?

Adeel
  • 19,075
  • 4
  • 46
  • 60
0

I agree with Adeel... it can't be trapped.

However, you can supply the required authentication header manually - to prevent the prompt from ever appearing - if the user has already "logged in" and you know their un/pw on the client side.

Steve
  • 31,144
  • 19
  • 99
  • 122
  • Well, if it can't be trapped, it can't be trapped. Following this answer, I think what I should do is bring up a popup dialog with the login page of the target server prior to any calls. Thanks. – mydoghasworms Jun 07 '11 at 14:57
0

Per this thread How do I make a JSONP call with JQuery with Basic Authentication? it seems like you would need to proxy all the requests through server-side to detect and override http-level authentication challenges.

Community
  • 1
  • 1
Jim Thomas
  • 1,658
  • 11
  • 7