Disable Alfresco rest api basic auth popup

cancel
Showing results for 
Search instead for 
Did you mean: 
vikash_patel
Established Member II

Disable Alfresco rest api basic auth popup

Jump to solution

Hi,

I am using Angular Version 6 & Alfresco community version 5.2

"@alfresco/adf-content-services": "2.6.1",

"@alfresco/adf-core": "2.6.1",

On API call if I am logged out and calling the webscript/api from angular I got the basic auth popup every time.

I need to disable it.
Is there any way to do the same?

I have asked the same question on stackoverflow platform
angular6 - Disable Alfresco rest api basic auth popup - Stack Overflow 

1 Solution

Accepted Solutions
eugenio_romano
Alfresco Employee

Re: Disable Alfresco rest api basic auth popup

Jump to solution

Hi this problem has been solved in the last version of the content service 6.0.0. If you want a workaround for your project witout update the CS you nee to use something similar on what we do in onProxyRes:

module.exports = {
"/alfresco": {
"target": "http://localhost:8080",
"secure": false,
"pathRewrite": {
"^/alfresco/alfresco": ""
},
"changeOrigin": true,
// workaround for REPO-2260
onProxyRes: function (proxyRes, req, res) {
const header = proxyRes.headers['www-authenticate'];
if (header && header.startsWith('Basic')) {
proxyRes.headers['www-authenticate'] = 'x' + header;
}
}
},
"/activiti-app": {
"target": "http://localhost:8080",
"secure": false,
"pathRewrite": {
"^/activiti-app/activiti-app": ""
},
"changeOrigin": true
}
};

View solution in original post

3 Replies
eugenio_romano
Alfresco Employee

Re: Disable Alfresco rest api basic auth popup

Jump to solution

Hi this problem has been solved in the last version of the content service 6.0.0. If you want a workaround for your project witout update the CS you nee to use something similar on what we do in onProxyRes:

module.exports = {
"/alfresco": {
"target": "http://localhost:8080",
"secure": false,
"pathRewrite": {
"^/alfresco/alfresco": ""
},
"changeOrigin": true,
// workaround for REPO-2260
onProxyRes: function (proxyRes, req, res) {
const header = proxyRes.headers['www-authenticate'];
if (header && header.startsWith('Basic')) {
proxyRes.headers['www-authenticate'] = 'x' + header;
}
}
},
"/activiti-app": {
"target": "http://localhost:8080",
"secure": false,
"pathRewrite": {
"^/activiti-app/activiti-app": ""
},
"changeOrigin": true
}
};
vikash_patel
Established Member II

Re: Disable Alfresco rest api basic auth popup

Jump to solution

Thank you very much, Eugenio Romano‌ for your reply,

Let me check & implement this.

jamilnour
Established Member

Re: Disable Alfresco rest api basic auth popup

Jump to solution

Hello,

I have the same issue when using ADF extension. On the main application it works fine and issue is solved but after the creation of an extension (https://alfresco-content-app.netlify.com/#/extending/extensibility-features) I have the problem back again

Note that I amusing ACS 6.1

As for the workarround you mentionned I can't apply to an extension because I don't have proxy.conf.js in the structure but only a proxy.conf.json. 

proxy.conf.js has the fix you mentionned

Any idea?

Thank you

Jamil