Skip to content

Commit

Permalink
fix(edge): Remove new X-ClientID header from v1.0 requests
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 committed Dec 11, 2024
1 parent c7bc76d commit 5446ac0
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/edge/edge-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ export class EdgeApi {
method: 'POST',
body: file,
headers: {
Authorization: this.getAuthHeader(params.token),
'X-ClientID': this.options.clientId,
...this.getAuthHeaders(params.token),
'Content-Type': 'application/zip',
},
});
Expand All @@ -110,10 +109,7 @@ export class EdgeApi {
}): Promise<DraftOperation> {
const endpoint = `https://api.addons.microsoftedge.microsoft.com/v1/products/${params.productId}/submissions/draft/package/operations/${params.operationId}`;
return fetch(endpoint, {
headers: {
Authorization: this.getAuthHeader(params.token),
'X-ClientID': this.options.clientId,
},
headers: this.getAuthHeaders(params.token),
});
}

Expand All @@ -128,14 +124,16 @@ export class EdgeApi {
const res = await fetch(endpoint, {
method: 'POST',
body: JSON.stringify({}),
headers: {
Authorization: this.getAuthHeader(params.token),
'X-ClientID': this.options.clientId,
},
headers: this.getAuthHeaders(params.token),
});
}

private getAuthHeader(token: EdgeTokenDetails): string {
return `${token.token_type} ${token.access_token}`;
private getAuthHeaders(token: EdgeTokenDetails): Record<string, string> {
return {
Authorization: `${token.token_type} ${token.access_token}`,
...(token.token_type === 'ApiKey'
? { 'X-ClientID': this.options.clientId }
: {}),
};
}
}

0 comments on commit 5446ac0

Please sign in to comment.