Dela via


DeviceCodeCredential Class

Definition

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
DeviceCodeCredential

Constructors

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

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.

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(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