04-03-2017 07:54 AM
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?
04-04-2017 06:14 AM
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.
04-03-2017 09:25 AM
Hi Martin,
Which is the error you get?
04-03-2017 09:47 AM
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
04-03-2017 10:19 AM
now I get
"errorKey":"Ticket base authentication required.","statusCode":400,"briefSummary":"03030007 Ticket base authentication required."
04-04-2017 06:14 AM
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.
04-04-2017 06:20 AM
Hi Eugenio,
thank you very much
04-05-2017 08:30 AM
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)
04-05-2017 11:10 AM
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)
Explore our Alfresco products with the links below. Use labels to filter content by product module.