this._initAuthentication is not a function
It's my first time using nuxeo.js. I added nuxeo.js to the asp.net mvc application Scripts folder and made the reference to it in my .aspx page head section. I'm trying to access nuxeo server with this code:
$(document).ready(function () {
var client = new nuxeo.Client({<br/>
baseURL: 'http://192.168.15.128/nuxeo',<br/>
restPath: 'api/v1',<br/>
automationPath: 'site/api/v1/automation',<br/>
auth: {<br/>
method: 'basic',<br/>
username: 'myusername',<br/>
password: 'mypassword'<br/>
},<br/>
timeout: 30000 <br/>
})<br/>
});
My browser console error list always get the message: “Uncaught TypeError: this._initAuthentication is not a function”
Debugging I realized that in line 43 of nuxeo.js we have a call to this._initAuthentication() and I can't find the implementation to this function. I am probably missing something.
Can anyone give me a help?
Hi,
My bad, I've done a fix.
You can try to use the updated client: https://github.com/nuxeo/nuxeo-js-client/blob/master/lib/jquery/nuxeo.js
Will post a new version 0.5.1 to bower (if you're using it).
Thanks for the report.
// something went wrong</br>
throw error;</br>
}</br>
console.log(user)</br> });
Could you share your whole code? Through a gist for instance.
Thanks.
$(document).ready(function () {<br/> <br/>
var client = new nuxeo.Client({<br/>
baseURL: 'http://192.168.1.126/nuxeo/',<br/>
restPath: 'site/api/v1/', <br/>
automationPath: 'site/api/v1/automation/', <br/>
auth: { <br/>
method: 'basic', <br/>
username: 'myuser', <br/>
password: 'mypassword' <br/>
}, <br/>
timeout: 30000 <br/>
}); <br/>
<br/>
client.connect(function (error, client) { <br/>
if (error) { <br/>
// cannot connect <br/>
throw error; <br/>
} <br/>
// OK, the returned client is connected <br/>
console.log('Client is connected: ' + client.connected); <br/>
}); <br/>
<br/>
client.request('user/Administrator') <br/>
.get(function(error, user) { <br/>
if (error) { <br/>
// something went wrong <br/>
throw error; <br/>
} <br/>
<br/>
console.log(user) <br/>
}); <br/>
}); <br/> <br/> The results in the console are: <br/> Client is connected: false <br/> null <br/> I have this error message in the console:<br/> XMLHttpRequest cannot load http://192.168.1.126/nuxeo/site/api/v1/automation/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:52652' is therefore not allowed access. The response had HTTP status code 401.