Class InteractiveBrowserCredential
A TokenCredential implementation which launches the system default browser to interactively authenticate a user, and obtain an access token. The browser will only be launched to authenticate the user once, then will silently acquire access tokens through the users refresh token as long as it's valid.
Namespace: Azure.Identity
Assembly: Azure.Identity.dll
Syntax
public class InteractiveBrowserCredential : Azure.Core.TokenCredential
Constructors
InteractiveBrowserCredential()
Creates a new InteractiveBrowserCredential with the specified options, which will authenticate users.
Declaration
public InteractiveBrowserCredential ();
InteractiveBrowserCredential(String)
Creates a new InteractiveBrowserCredential with the specified options, which will authenticate users with the specified application.
Declaration
public InteractiveBrowserCredential (string clientId);
Parameters
String
clientId
The client id of the application to which the users will authenticate |
InteractiveBrowserCredential(String, String, TokenCredentialOptions)
Creates a new InteractiveBrowserCredential with the specified options, which will authenticate users with the specified application.
Declaration
public InteractiveBrowserCredential (string tenantId, string clientId, Azure.Identity.TokenCredentialOptions options = null);
Parameters
String
tenantId
The tenant id of the application and the users to authenticate. Can be null in the case of multi-tenant applications. |
String
clientId
The client id of the application to which the users will authenticate |
TokenCredentialOptions
options
The client options for the newly created DeviceCodeCredential |
Methods
GetToken(TokenRequestContext, CancellationToken)
Obtains an AccessToken token for a user account silently if the user has already authenticated, otherwise the default browser is launched to authenticate the user. This method is called by Azure SDK clients. It isn't intended for use in application code.
Declaration
public override Azure.Core.AccessToken GetToken (Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken = null);
Parameters
Azure.Core.TokenRequestContext
requestContext
The details of the authentication request. |
CancellationToken
cancellationToken
A CancellationToken controlling the request lifetime. |
Returns
AccessToken
An AccessToken which can be used to authenticate service client calls. |
GetTokenAsync(TokenRequestContext, CancellationToken)
Obtains an AccessToken token for a user account silently if the user has already authenticated, otherwise the default browser is launched to authenticate the user. This method is called by Azure SDK clients. It isn't intended for use in application code.
Declaration
[System.Diagnostics.DebuggerStepThrough]
public override System.Threading.Tasks.ValueTask<Azure.Core.AccessToken> GetTokenAsync (Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken = null);
Parameters
Azure.Core.TokenRequestContext
requestContext
The details of the authentication request. |
CancellationToken
cancellationToken
A CancellationToken controlling the request lifetime. |
Returns
ValueTask<AccessToken>
An AccessToken which can be used to authenticate service client calls. |