Disable Alfresco rest api basic auth popup

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

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
Highlighted
Moderator
Moderator

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

2 Replies
Highlighted
Moderator
Moderator

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

vikash_patel
Established Member

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.