Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Browser authentication dialog when HTTPService fails with a 401 response code


Level 1
I am using a HTTP Service to talk to a third party API and
passing username/password in HTTP Basic Auth header.

When i enter wrong credentials through my application, as
expected i get a 401 unauthorized response. But before the fault
handler gets called, my browser shows the authentication dialog
asking me to re-enter the username/password.

It happens on safari and firefox browser on OS X. I have not
checked other environments.

Is this expected? I do not want the browser to show me an
authentication dialog and want my application

to handle the 401 error.


3 Replies


Level 2
this is really a browser issue outside the scope of data
services. my best guess is to use javascript in the html wrapper to
silence the 401 responses.


Level 1
Is there any way to catch the 401 header response from HTTP
service or repress air from showing it? Using JavaScript will solve
the problem but I prefer to keep it all in AS if possible.


Level 1

Having same problem trying to do BASIC authentication via HTTPService. Any thoughts on how to suppress dialog after a 401 is returned from server on a HTTPService request?