I'm using an AngularJS (1.6) SPA with the alfresco-js-api directly in the browser.
Thought I should be able to login with a valid ticket using
var ticket="XXXXXXXXXXXXX"; //valid ticket inside
var alfrescoApiInst = new AlfrescoApi({ provider:'ECM' });
alfrescoApiInst.loginTicket(ticket).then(function (data) {
console.log('valid ticket you are logged in');
}, function (error) {
console.error(error);
});
but this is not working.
But using the ticket in the constructor works
var alfrescoApiInst=new AlfrescoApi({ticketEcm:ticket,hostEcm:hostUrl,provider:"ECM"});
It works with the constructor, but did I miss anything or got it totally wrong?
Solved! Go to Solution.
Hi Martin,
I opened an issue for you :
loginTicket(ticket) 400 response · Issue #209 · Alfresco/alfresco-js-api · GitHub
please refer to it for further update.
In the meantime, I suggest you use constructor way.
Hi Martin,
Which is the error you get?
Hi Francesco,
I obtain the ticket through a alfresco web-script that returns a javascript object (template):
alfUserData={
"ticket":"${sessionticket.ticket}",
"firstName":"${person.properties.firstName}",
"lastName":"${person.properties.lastName}",
"userName":"${person.properties.userName}",
"email":"${person.properties.email}"
};
this is loaded as script before the angularJs app and called via wcs to use the configured SSO mechanism.
<script src="alfresco/wcs/autoticket"></script>
so I avoid the fiddling with the asynchrony and I have a valid global (initial) ticket before starting the next javascript.
But when using the loginTicket(ticket) there is an internal-error on calling the "loginTicket" method:
alfresco-js-api.min.js:6 OPTIONS http://127.0.0.1:8080/alfresco/api/-default-/public/authentication/versions/1/tickets/-me- 401 (Unauthorized)
Calling the constructor with the ticket is ok. But I fear I really missunderstood something.
I have to say, in this case I'm not on nodeJs, it's just a SPA hosted on the alfresco site.
...and now I see alfresco-js-api.min.js is calling the host http://127.0.0.1:8080 but it should call http://dms - and because I also run an alfresco locally this gives the unauthorized error - the ticket is not valid for another alfresco system
But everything is initialized with url http://dms - is http://127.0.0.1:8080 hardcoded in the js-api or am I missing just the ecmhost parameter...
Didn't recognize the wrong 127.0.0.1 before...
Happy Office hours
now I get
"errorKey":"Ticket base authentication required.","statusCode":400,"briefSummary":"03030007 Ticket base authentication required."
Hi Martin,
I opened an issue for you :
loginTicket(ticket) 400 response · Issue #209 · Alfresco/alfresco-js-api · GitHub
please refer to it for further update.
In the meantime, I suggest you use constructor way.
Hi Eugenio,
thank you very much
Hi Martin,
The team released the ADF 1.3 LA few hours ago with the bugfix to this problem included.
Release 1.3.0 · Alfresco/alfresco-ng2-components · GitHub
Maybe you are interested to the JS-API release note.
Release 1.3.0 · Alfresco/alfresco-js-api · GitHub
Check it out!
(and many thanks to the team)
Hi Francesco and Eugenio,
no more login problems with the 1.3.0 Release The issue is resolved. That was fast
Thank you very much (the whole team)
Discussions, help and advice about the Alfresco Development Framework.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.