Skip to content

Commit

Permalink
Fix acquireToken in managedIdentitiesClient by adding the correct hea…
Browse files Browse the repository at this point in the history
…ders and fix url redundant char (#109)

* Fix acquireToken in managedIdentitiesClient by adding the correct headers and fix url redundant char

* Bump version to 2.1.1
  • Loading branch information
yershalom authored Jan 3, 2021
1 parent 75edf79 commit 2107da4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion azure-kusto-data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-kusto-data",
"version": "2.1.0",
"version": "2.1.1",
"description": "Azure Data Explorer Query SDK",
"main": "index.js",
"types": "index.d.ts",
Expand All @@ -26,6 +26,7 @@
},
"author": "",
"license": "ISC",
"homepage": "https://github.com/Azure/azure-kusto-node/blob/master/azure-kusto-data/README.md",
"dependencies": {
"@azure/ms-rest-nodeauth": "^3.0.3",
"adal-node": "^0.1.28",
Expand Down
6 changes: 4 additions & 2 deletions azure-kusto-data/source/managedIdentitiesClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ const MSI_API_VERSION = "2018-02-01";
const MSI_FUNCTION_API_VERSION = "2017-09-01";

export default function acquireToken<T>(resource: string, msiEndpoint: string, msiClientId: string, msiSecret: string, callback: (error: string | null, token?: { tokenType: string; accessToken: string }) => T) {
let msiUri = `${msiEndpoint}/?resource=${resource}&api-version=${msiSecret ? MSI_FUNCTION_API_VERSION : MSI_API_VERSION}`;
let msiUri = `${msiEndpoint}?resource=${resource}&api-version=${msiSecret ? MSI_FUNCTION_API_VERSION : MSI_API_VERSION}`;

if (msiClientId) {
msiUri += `&client_id=${msiClientId}`;
}

const headers: any = {};
const headers: any = {
Metadata: true
};

if (msiSecret) {
headers.Secret = msiSecret;
Expand Down

0 comments on commit 2107da4

Please sign in to comment.