cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure Alfresco 4.0.e allowing callback for json

pierluigi
Champ in-the-making
Champ in-the-making
Hi everybody, this is my first post here…

I would like to provide (in Alfresco 4.0.e) the mechanism which wraps the JSON output text in parentheses and a function name (the callback). A callback is invoked by adding the following URL parameter on JSON URL requests:
alf_callback=function
where function is the name of a client-side JavaScript function to be invoked.

As suggested here:
http://wiki.alfresco.com/wiki/Web_Scripts#JSON_Callbacks
I have tried adding this line
"<property name="allowCallbacks"><value>true</value></property>"
in this cofiguration file
"/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/web-scripts-application-context.xml"

but now when my application tries to execute a script, it appears a login window with unknows username and password…

Any suggests?
Thanks in advance
1 REPLY 1

abarisone
Star Contributor
Star Contributor
Hi,
your application must pass a valid ticket when you call a webscript, unless you have a SSO mechanism that sets a cookie for Alfresco.
Namely, you can add to your url the fragment alf_ticket=<TICKET_hex_sequence>
This sequence can be obtained using this Alfresco webscript username>&pw=<password>'>http://localhost:8080/alfresco/service/api/login?u=<username>&pw=<password>
Conversely if you get a basic authentication dialog and provide correct login/pwd for a existing user this will be kept while your session is valid and asked no more.

Hope this helps

P.S.: but why do you need JSON callbacks? This could lead to many security issues…