Skip to content

Commit 3bbf412

Browse files
committed
implement-code-change-to-artcile
1 parent 4a6afa6 commit 3bbf412

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

articles/active-directory/develop/workload-identity-federation-create-trust-gcp.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -206,19 +206,21 @@ class ClientAssertionCredential implements TokenCredential {
206206

207207
// Get the ID token from Google.
208208
return getGoogleIDToken() // calling this directly just for clarity,
209-
// this should be a callback
210-
// pass this as a client assertion to the confidential client app
211-
.then((clientAssertion:any)=> {
212-
var msalApp: any;
213-
msalApp = new msal.ConfidentialClientApplication({
214-
auth: {
215-
clientId: this.clientID,
216-
authority: this.aadAuthority + this.tenantID,
217-
clientAssertion: clientAssertion,
218-
}
219-
});
220-
return msalApp.acquireTokenByClientCredential({ scopes })
221-
})
209+
210+
let aadAudience = "api://AzureADTokenExchange"
211+
const jwt = axios({
212+
213+
url: "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience="
214+
+ aadAudience,
215+
method: "GET",
216+
headers: {
217+
"Metadata-Flavor": "Google"
218+
}}).then(response => {
219+
console.log("AXIOS RESPONSE");
220+
return response.data;
221+
});
222+
return jwt;
223+
222224
.then(function(aadToken) {
223225
// return in form expected by TokenCredential.getToken
224226
let returnToken = {

0 commit comments

Comments
 (0)