Class DeviceCodeAuthenticationProvider
Authentication Provider that uses a device code flow for authentication
public class DeviceCodeAuthenticationProvider : OAuthAuthenticationProvider, IAuthenticationProvider
- Inheritance
-
DeviceCodeAuthenticationProvider
- Implements
- Inherited Members
Constructors
DeviceCodeAuthenticationProvider(ILogger<OAuthAuthenticationProvider>, IMsalHttpClientFactory)
Public constructor leveraging DI to initialize the ILogger and IMsalHttpClientFactory interfaces
public DeviceCodeAuthenticationProvider(ILogger<OAuthAuthenticationProvider> logger, IMsalHttpClientFactory msalHttpClientFactory)
Parameters
loggerILogger<OAuthAuthenticationProvider>The instance of the logger service provided by DI
msalHttpClientFactoryIMsalHttpClientFactoryThe instance of the Msal Http Client Factory service provided by DI
DeviceCodeAuthenticationProvider(string, string, PnPCoreAuthenticationDeviceCodeOptions, Action<DeviceCodeNotification>)
Public constructor for external consumers of the library
public DeviceCodeAuthenticationProvider(string clientId, string tenantId, PnPCoreAuthenticationDeviceCodeOptions options, Action<DeviceCodeNotification> deviceCodeVerification)
Parameters
clientIdstringThe Client ID for the Authentication Provider
tenantIdstringThe Tenant ID for the Authentication Provider
optionsPnPCoreAuthenticationDeviceCodeOptionsOptions for the authentication provider
deviceCodeVerificationAction<DeviceCodeNotification>External action to manage the Device Code verification
DeviceCodeAuthenticationProvider(string, string, Uri, Action<DeviceCodeNotification>)
Public constructor for external consumers of the library
public DeviceCodeAuthenticationProvider(string clientId, string tenantId, Uri redirectUri, Action<DeviceCodeNotification> deviceCodeVerification)
Parameters
clientIdstringThe Client ID for the Authentication Provider
tenantIdstringThe Tenant ID for the Authentication Provider
redirectUriUriThe Redirect URI for the authentication flow
deviceCodeVerificationAction<DeviceCodeNotification>External action to manage the Device Code verification
Properties
DeviceCodeVerification
Action to notify the end user about the device code request
public Action<DeviceCodeNotification> DeviceCodeVerification { get; set; }
Property Value
RedirectUri
The Redirect URI for the authentication flow
public Uri RedirectUri { get; set; }
Property Value
Methods
AuthenticateRequestAsync(Uri, HttpRequestMessage)
Authenticates the specified request message.
public override Task AuthenticateRequestAsync(Uri resource, HttpRequestMessage request)
Parameters
resourceUriRequest uri
requestHttpRequestMessageThe HttpRequestMessage to authenticate.
Returns
- Task
The task to await.
GetAccessTokenAsync(Uri)
Gets an access token for the requested resource
public override Task<string> GetAccessTokenAsync(Uri resource)
Parameters
resourceUriResource to request an access token for
Returns
GetAccessTokenAsync(Uri, string[])
Gets an access token for the requested resource and scope
public override Task<string> GetAccessTokenAsync(Uri resource, string[] scopes)