Skip to content

Commit 4466124

Browse files
committed
Code optimization and FAQ update
1 parent 554f7d8 commit 4466124

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

lib/msal-browser/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ The `authority` string that you need to supplant to MSAL app configuration is no
241241

242242
## What does authority string default to if I provide "authority" and "azureCloudOptions"?
243243

244-
If the developer provides `azureCloudOptions`, we overwrite any value provided in the `authority`. We also make sure we give preference to these options provided in a `request` over what is set when the msal initializes in the `configuration`.
244+
If the developer provides `azureCloudOptions`, MSAL.js will overwrite any value provided in the `authority`. MSAL.js will also give preference to the parameters provided in a `request` over `configuration`. Please note that if `azureCloudOptions` are set in the configuration, they will take precedence over `authority` in the `request`. If the developer needs to overwrite this, they need to set `azureCloudOptions` in the request.
245245

246246
## What should I set my `redirectUri` to?
247247

lib/msal-browser/src/interaction_client/StandardInteractionClient.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -220,23 +220,13 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
220220
authorityMetadata: this.config.auth.authorityMetadata,
221221
};
222222

223-
// Fetch the authority from request if provided, default if the user authority is not defined
224-
const userRequestedAuthority = requestAuthority ? requestAuthority : Constants.DEFAULT_AUTHORITY;
225-
226-
// build authority string based on auth params, precedence - azureCloudInstance + tenant >> authority and request parameters >> config parameters
227-
const generatedAuthority = requestAzureCloudOptions ?
228-
Authority.generateAuthority(userRequestedAuthority, requestAzureCloudOptions) :
229-
Authority.generateAuthority(userRequestedAuthority);
230-
231-
if (generatedAuthority) {
232-
this.logger.verbose("Creating discovered authority with request authority");
233-
return await AuthorityFactory.createDiscoveredInstance(generatedAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions);
234-
}
223+
// build authority string based on auth params, precedence - azureCloudInstance + tenant >> authority
224+
const userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
235225

236226
// fall back to the authority from config
237-
const configAuthority = Authority.generateAuthority(this.config.auth.authority, this.config.auth.azureCloudOptions);
227+
const builtAuthority = Authority.generateAuthority( userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
238228
this.logger.verbose("Creating discovered authority with configured authority");
239-
return await AuthorityFactory.createDiscoveredInstance(configAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions);
229+
return await AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions);
240230
}
241231

242232
/**

0 commit comments

Comments
 (0)