Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

DeviceCodeCredential Class

Definition

Namespace:
Azure.Identity
Assemblies:
Azure.Core.dll, Azure.Identity.dll
Assembly:
Azure.Identity.dll
Packages:
Azure.Core v1.58.0, Azure.Identity v1.17.2
Package:
Azure.Identity v1.18.0-beta.3
Source:
DeviceCodeCredential.cs
Source:
DeviceCodeCredential.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

A TokenCredential implementation which authenticates a user using the device code flow, and provides access tokens for that user account. For more information on the device code authentication flow see https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Device-Code-Flow.

public class DeviceCodeCredential : Azure.Core.TokenCredential
type DeviceCodeCredential = class
 inherit TokenCredential
Public Class DeviceCodeCredential
Inherits TokenCredential
Inheritance

Constructors

Name Description
DeviceCodeCredential()

Creates a new DeviceCodeCredential, which will authenticate users using the device code flow.

DeviceCodeCredential(DeviceCodeCredentialOptions)

Creates a new DeviceCodeCredential with the specified options, which will authenticate users using the device code flow.

Methods

Name Description
Authenticate(CancellationToken)

Interactively authenticates a user via the default browser.

Authenticate(TokenRequestContext, CancellationToken)

Interactively authenticates a user via the default browser.

AuthenticateAsync(CancellationToken)

Interactively authenticates a user via the default browser.

AuthenticateAsync(TokenRequestContext, CancellationToken)

Interactively authenticates a user via the default browser.

CreateTokenOptions(IReadOnlyDictionary<String,Object>)

Creates a new instance of GetTokenOptions using the provided properties.

(Inherited from TokenCredential)
GetToken(GetTokenOptions, CancellationToken)

Gets an AuthenticationToken for the provided properties.

(Inherited from TokenCredential)
GetToken(TokenRequestContext, CancellationToken)

Obtains a token for a user account, authenticating them through the device code authentication flow. Acquired tokens are cached by the credential instance. Token lifetime and refreshing is handled automatically. Where possible, reuse credential instances to optimize cache effectiveness.

GetTokenAsync(GetTokenOptions, CancellationToken)

Gets an AuthenticationToken for the provided properties.

(Inherited from TokenCredential)
GetTokenAsync(TokenRequestContext, CancellationToken)

Obtains a token for a user account, authenticating them through the device code authentication flow. Acquired tokens are cached by the credential instance. Token lifetime and refreshing is handled automatically. Where possible, reuse credential instances to optimize cache effectiveness.

Applies to


Feedback

Was this page helpful?