folder share URL is asking for authentication

cancel
Showing results for 
Search instead for 
Did you mean: 
ayushi_agrahari
Active Member II

folder share URL is asking for authentication

Hi all,

I have made a project for sharing the contents of file and folder in alfrecso.The github link for my project is

GitHub - ayushiagrahari95/share-link-expiry-file-and-folder and it is working fine on local but when I have deployed the amps on production,whenever I click on the make public action,a URL is generated on the folder and when I click on that URL,it is asking for authentication (prompts the user to enter the username and password) but on local,the URL is opening properly in the new tab without asking for authentication.

I am unable to figure out why the URL is asking for authentication on prod and not on local.

any help would be greatly appreciated

Thanks

7 Replies
Highlighted
jpotts
Advanced II

Re: folder share URL is asking for authentication

It's cool you made that code available on github, but maybe grab the section you think might be the problem and post it here so people don't have to go hunt for it. For example, what URL are you generating for the folder?

ayushi_agrahari
Active Member II

Re: folder share URL is asking for authentication

Hello Jeff,

I am trying to call the repo webscript from share side.

The space-list.js file in share-link-expiry-file-and-folder/Ev-share-make-public-share/src/main/resources/META-INF/components/make-public is calling the repo webscript in the following way

var requestUrl = window.location.protocol + "//" + window.location.host + "/alfresco/s/eu/xfel/make-public/doclist?nodeRef=" + this.options.nodeRef + "&guest=true";
   
The doclist repo webscript is a webscript that has guest authentication but on calling this webscript on prod,the url that is generated is asking for authentication and is able to call the repo side webscript only after authentication.
I am not able to figure out why it is asking for authentication in prod and not in local
Any help would be greatly appreciated.
Thanks
jpotts
Advanced II

Re: folder share URL is asking for authentication

Did you add the GUEST user with Consumer access (or higher) to the node?

ayushi_agrahari
Active Member II

Re: folder share URL is asking for authentication

Yes,I have added the guest access with consumer access to the node in the local as well as production but as I have already told u that the amps of project is working perfectly on local but the issue is actually when I deploy the amps on production.

I can't figure out why it is asking for authentication on production but not on local

jpotts
Advanced II

Re: folder share URL is asking for authentication

It looks like you are calling a repo-tier web script from client-side JavaScript. Is that what you intend? When everything (the browser and the server) is on the same machine, that might work okay, but as soon as your client and server are on different machines, you will run into trouble.

Instead of calling a repo-tier web script from client-side JavaScript, consider calling the Share proxy web script instead. In this case your client-side JavaScript would invoke /share/proxy/alfresco/eu/xfel/make-public/doclist?nodeRef...

Another advantage of doing that is that Share will handle repo authentication for you and you won't have to fool with Guest access. 

ayushi_agrahari
Active Member II

Re: folder share URL is asking for authentication

Hi Jeff,

I have tried ur solution and instead of calling the repo side webscript from client side javascript,I am calling the share proxy webscript in the following way.

var requestUrl =  "/share/proxy/alfresco/eu/xfel/make-public/doclist?nodeRef="+ this.options.nodeRef;

it is working without authentication on production,but now the another problem is that when I tried to open the same URL in other browser,the page is not loading.I can't figure out why this is so.

but calling the repo side webscript from client side javascript by

var requestUrl =  window.location.protocol + "//" + window.location.host + "/alfresco/s/eu/xfel/make-public/doclist?nodeRef=" + this.options.nodeRef + "&guest=true";

is working for other browsers also but is asking for authentication.

I can't figure out why this is so.....

Any help is greatly appreciated

Regards

Ayushi Agrahari

ayushi_agrahari
Active Member II

Re: folder share URL is asking for authentication

Hi all,

After doing googling,I have changed the authentication in the webscript xml descriptor in the following way.In doclist.get.desc.xml,I have changed 

<authentication>guest</authentication>

to

<authentication runas="guest">none</authentication>

and now it is working perfectly and is no longer asking for authentication while calling the webscript.

Regards

Ayushi Agrahari