mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 10:20:29 -06:00
Fix: Handle withCredentials option properly for loki datasource (#36914)
The loki datasource was not passing the credentials info to the fetch() API when loki was in Browser access mode. This is similar to: https://github.com/grafana/grafana/pull/23380
This commit is contained in:
parent
4f315bf48f
commit
aa3a46272f
@ -87,6 +87,12 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
|
||||
const baseUrl = this.instanceSettings.url;
|
||||
const params = data ? serializeParams(data) : '';
|
||||
const url = `${baseUrl}${apiUrl}${params.length ? `?${params}` : ''}`;
|
||||
if (this.instanceSettings.withCredentials || this.instanceSettings.basicAuth) {
|
||||
options = { ...options, withCredentials: true };
|
||||
if (this.instanceSettings.basicAuth) {
|
||||
options.headers = { ...options.headers, Authorization: this.instanceSettings.basicAuth };
|
||||
}
|
||||
}
|
||||
const req = {
|
||||
...options,
|
||||
url,
|
||||
|
Loading…
Reference in New Issue
Block a user