你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
InteractiveBrowserCredentialNodeOptions interface
定义 InteractiveBrowserCredential 类的常用选项。
- Extends
属性
client |
客户端 (应用程序) 租户中应用注册的 ID。 |
login |
loginHint 允许为交互式登录预先选择用户名。 设置此选项会跳过帐户选择提示,并立即尝试使用指定的帐户登录。 |
redirect |
获取应用程序的重定向 URI。 这应与应用程序注册门户中的值相同。 默认为 |
tenant |
Microsoft Entra租户 (目录) ID。 |
继承属性
additionally |
对于多租户应用程序,指定凭据可能为其获取令牌的其他租户。 添加通配符值“*”以允许凭据为安装应用程序的任何租户获取令牌。 |
additional |
要包含在 HTTP 管道中的其他策略。 |
allow |
如果请求是通过 HTTP 而不是 HTTPS 发送的,则设置为 true |
authentication |
以前身份验证的结果,可用于检索每个单独帐户的缓存凭据。 如果应用程序希望为每个客户端 ID 和租户 ID 对使用多个帐户,则需要提供此功能。 可以通过调用凭据的
|
authority |
用于身份验证请求的颁发机构主机。 可以通过 AzureAuthorityHosts 获取可能的值。 默认为 "https://login.microsoftonline.com"。 |
broker |
使用 InteractiveBrowserCredential 时允许代理身份验证的选项 |
browser |
浏览器自定义的共享配置选项 |
disable |
如果需要手动身份验证,则引发 getToken。
开发人员需要调用 以 |
disable |
字段确定在尝试进行身份验证时是否执行实例发现。
将其设置为 |
http |
将用于发送 HTTP 请求的 HttpClient。 |
logging |
允许用户配置日志记录策略选项的设置,允许记录帐户信息和客户支持的个人身份信息。 |
proxy |
用于为传出请求配置代理的选项。 |
redirect |
有关如何处理重定向响应的选项。 |
retry |
用于控制如何重试失败请求的选项。 |
telemetry |
用于将常见遥测和跟踪信息设置为传出请求的选项。 |
tls |
用于配置 TLS 身份验证的选项 |
token |
存储凭据时,如果) 可用,则向持久性层提供的选项 (。 必须先注册持久性提供程序插件。 例如:
|
user |
用于将用户代理详细信息添加到传出请求的选项。 |
属性详细信息
clientId
客户端 (应用程序) 租户中应用注册的 ID。
clientId?: string
属性值
string
loginHint
loginHint 允许为交互式登录预先选择用户名。 设置此选项会跳过帐户选择提示,并立即尝试使用指定的帐户登录。
loginHint?: string
属性值
string
redirectUri
获取应用程序的重定向 URI。 这应与应用程序注册门户中的值相同。 默认为 window.location.href
。
Node.js 不再需要此字段。
redirectUri?: string | () => string
属性值
string | () => string
tenantId
Microsoft Entra租户 (目录) ID。
tenantId?: string
属性值
string
继承属性详细信息
additionallyAllowedTenants
对于多租户应用程序,指定凭据可能为其获取令牌的其他租户。 添加通配符值“*”以允许凭据为安装应用程序的任何租户获取令牌。
additionallyAllowedTenants?: string[]
属性值
string[]
additionalPolicies
要包含在 HTTP 管道中的其他策略。
additionalPolicies?: AdditionalPolicyConfig[]
属性值
allowInsecureConnection
如果请求是通过 HTTP 而不是 HTTPS 发送的,则设置为 true
allowInsecureConnection?: boolean
属性值
boolean
authenticationRecord
以前身份验证的结果,可用于检索每个单独帐户的缓存凭据。 如果应用程序希望为每个客户端 ID 和租户 ID 对使用多个帐户,则需要提供此功能。
可以通过调用凭据的 authenticate()
方法检索此记录,如下所示:
const authenticationRecord = await credential.authenticate();
authenticationRecord?: AuthenticationRecord
属性值
authorityHost
用于身份验证请求的颁发机构主机。 可以通过 AzureAuthorityHosts 获取可能的值。 默认为 "https://login.microsoftonline.com"。
authorityHost?: string
属性值
string
brokerOptions
使用 InteractiveBrowserCredential 时允许代理身份验证的选项
brokerOptions?: BrokerOptions
属性值
browserCustomizationOptions
浏览器自定义的共享配置选项
browserCustomizationOptions?: { errorMessage?: string, successMessage?: string }
属性值
{ errorMessage?: string, successMessage?: string }
disableAutomaticAuthentication
如果需要手动身份验证,则引发 getToken。
开发人员需要调用 以 authenticate()
控制何时手动进行身份验证。
disableAutomaticAuthentication?: boolean
属性值
boolean
继承自InteractiveCredentialOptions.disableAutomaticAuthentication
disableInstanceDiscovery
字段确定在尝试进行身份验证时是否执行实例发现。
将其设置为 true
将完全禁用实例发现和颁发机构验证。
因此,确保配置的颁发机构主机有效且可信至关重要。
此功能适用于无法访问元数据终结点的方案,例如在私有云或 Azure Stack 中。
实例发现过程需要从 https://login.microsoft.com/ 中检索颁发机构元数据以验证颁发机构。
disableInstanceDiscovery?: boolean
属性值
boolean
httpClient
将用于发送 HTTP 请求的 HttpClient。
httpClient?: HttpClient
属性值
loggingOptions
允许用户配置日志记录策略选项的设置,允许记录帐户信息和客户支持的个人身份信息。
loggingOptions?: LogPolicyOptions & { allowLoggingAccountIdentifiers?: boolean, enableUnsafeSupportLogging?: boolean }
属性值
LogPolicyOptions & { allowLoggingAccountIdentifiers?: boolean, enableUnsafeSupportLogging?: boolean }
proxyOptions
用于为传出请求配置代理的选项。
proxyOptions?: ProxySettings
属性值
redirectOptions
有关如何处理重定向响应的选项。
redirectOptions?: RedirectPolicyOptions
属性值
retryOptions
用于控制如何重试失败请求的选项。
retryOptions?: PipelineRetryOptions
属性值
telemetryOptions
用于将常见遥测和跟踪信息设置为传出请求的选项。
telemetryOptions?: TelemetryOptions
属性值
tlsOptions
用于配置 TLS 身份验证的选项
tlsOptions?: TlsSettings
属性值
tokenCachePersistenceOptions
存储凭据时,如果) 可用,则向持久性层提供的选项 (。
必须先注册持久性提供程序插件。 @azure/identity-cache-persistence
请参阅 NPM 上的包。
例如:
import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
useIdentityPlugin(cachePersistencePlugin);
async function main() {
const credential = new DeviceCodeCredential({
tokenCachePersistenceOptions: {
enabled: true
}
});
}
main().catch((error) => {
console.error("An error occurred:", error);
process.exit(1);
});
tokenCachePersistenceOptions?: TokenCachePersistenceOptions
属性值
继承自CredentialPersistenceOptions.tokenCachePersistenceOptions
userAgentOptions
用于将用户代理详细信息添加到传出请求的选项。
userAgentOptions?: UserAgentPolicyOptions