cancel
Showing results for 
Search instead for 
Did you mean: 

Share webscript 401 authentication issue

muralidharand
Star Contributor
Star Contributor
Hi experts,

I've developed a Repository post webscript without any authentication(i.e) <authentication>none</none>. Now, I want call this webscript from my share application,but I'm always hitting 401 error.


<webscript>
  <shortname>demo</shortname>
  <description>demo webscript</description>
  <url>/api/com/mywebscript/demo</url>
  <format default="json"/>
  <authentication>none</authentication>
  <transaction>required</transaction>
</webscript>



Alfresco.util.Ajax.request(
{
   url: Alfresco.constants.PROXY_URI +"api/com/mywebscript/demo",
   method: Alfresco.util.Ajax.POST,
   dataObj: dataobj,
   requestContentType: Alfresco.util.Ajax.JSON
});


If I hardcode the webscript URL, then it is working.


Alfresco.util.Ajax.request(
{
   url: "http://localhost:8080/alfresco/s/api/com/mywebscript/demo",
   method: Alfresco.util.Ajax.POST,
   dataObj: dataobj,
   requestContentType: Alfresco.util.Ajax.JSON
});


So, I wanted to know, how I can call webscript without any authentication?

I tried to look into api/login webscript, but I couldn't get much information from share application side.
3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator
Hello,

you can't use the regular "alfresco" proxy, since this is always an authenticated one. Instead, use the "alfresco-noauth" proxy, i.e. "http://localhost:8080/share/proxy/alfresco-noauth/api/com/mywebscript/demo".

Regards
Axel

Hi Axel,
Thanks for your suggestion.
Now, I'm able to call my webscript without any authentication.

Thanks once again.

zladuric
Champ on-the-rise
Champ on-the-rise
Yes, like Alex said, share proxy url is authenticated. I've ran into the same issue recently. Use no-auth or a direct URL like that (which is clumsy).