cancel
Showing results for 
Search instead for 
Did you mean: 

JS Client: Chrome login popup when authentication fails

Ezequiel_Leyton
Champ in-the-making
Champ in-the-making

Hello community

I'm having some problems with chrome and the basic authentication (jquery) with the javascript client from nuxeo. I have a form based login which works fine when the credentials are ok, but when the authentication fails, I get a popup from chrome asking for the credentials again. I have spent some time doing research and found out that this happens because chrome is getting a 401 response, and it automatically shows the popup. I tried several solutions as altering the Authorization header to other thing than "Basic ..." but I haven't had any luck. I wonder if any of you guys have come across this before and found a workaround.

This is my connection code, nuxeo's js library is untouched.


        var nuxeoclient = new nuxeo.Client({
            baseURL: 'http://localhost:8080/nuxeo',
            restPath: 'site/api/v1',
            automationPath: 'site/api/v1/automation',
            auth: {
                method: 'basic',
                username: form.username.value,
                password: form.password.value
            },
            timeout: 30000

        })
        var h = nuxeoclient._headers;
        nuxeoclient._computeAuthentication(h);

        nuxeoclient.connect(function(error, client) {
            if (error) {
                //do stuff
            }else{
                ///blah blah
            }
        });
1 ACCEPTED ANSWER

Thomas_Roger
Star Contributor
Star Contributor

Hi,

You can add the X-No-Basic-Header header to avoid browser popup for authentication.

...
client.header('X-No-Basic-Header', true);
client.connect(...)
...

View answer in original post

2 REPLIES 2

Thomas_Roger
Star Contributor
Star Contributor

Hi,

You can add the X-No-Basic-Header header to avoid browser popup for authentication.

...
client.header('X-No-Basic-Header', true);
client.connect(...)
...

Thank you Thomas, it worked!

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.