Skip to content

Commit

Permalink
Merge pull request #2552 from Azure/hotfix/proxy-config-login-error
Browse files Browse the repository at this point in the history
Fixes a login issue related to proxy config
  • Loading branch information
gingi authored Aug 1, 2022
2 parents 507127f + 43565df commit 2423e88
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.14.2

### Bugs

* Fixes login failures when proxy is misconfigured [\#2551]

# 2.14.1

### Bugs
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"name": "Microsoft Corporation",
"email": "[email protected]"
},
"version": "2.14.1",
"version": "2.14.2",
"main": "build/client/main.prod.js",
"scripts": {
"ts": "ts-node --project tsconfig.node.json --files",
Expand Down
10 changes: 8 additions & 2 deletions src/client/core/aad/auth-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ export default class AuthProvider {

private async _createClient(tenantId: string):
Promise<PublicClientApplication> {
const proxySettings = await this.app.proxySettings.settings;
const proxyUrl = proxySettings?.http.toString();
const proxyUrl = await this._loadProxyUrl();

if (proxyUrl) {
log.info(`[${tenantId}] Proxying auth endpoints through ` +
proxyUrl);
Expand All @@ -197,6 +197,12 @@ export default class AuthProvider {
});
}

private async _loadProxyUrl() {
const proxySettings = await this.app.proxySettings.settings;
const protocolUrl = proxySettings?.https ?? proxySettings?.http;
return protocolUrl?.toString();
}

private async _getAccount(tenantId: string): Promise<AccountInfo> {
if (tenantId in this._accounts) {
return this._accounts[tenantId];
Expand Down

0 comments on commit 2423e88

Please sign in to comment.