'Adding extra headers in sonarqube webhook
In our node application, we are using sonarqube-scanner package. To connect to the sonarqube instance, we were giving 2 parameters in serverUrl and token
(async function() {
await config.initEnvironmentVariables();
sonarqubeScanner({
serverUrl: nodecache.getValue('SONARQUBE_URL'),
token: nodecache.getValue('SONARQUBE_TOKEN'),
options: {
'sonar.sources': 'src/modules',
'sonar.tests': 'tests',
'sonar.inclusions': '**',
'sonar.test.inclusions': 'tests/**/*.spec.js',
'sonar.javascript.lcov.reportPaths': 'coverage/lcov.info',
'sonar.testExecutionReportPaths': 'coverage/test-report.xml'
}
}, () => process.exit());
})();
The problem now is, we have our sonarqube instance under custom authentication. Meaning first we have to log in, then we see the sonarqube login page, then when we log in to sonarqube, we can see the sonarqube reports.
Using serverUrl and token we can authenticate sonarqube instance. But to get through custom auth on top of it, we need to provide extra headers.
My question is: If we can, How we can we add extra headers to the request that authenticates with sonarqube instance.
Ok.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

