Class DeviceCodeAuthenticationProvider
Authentication Provider that uses a device code flow for authentication
Inherited Members
Namespace: PnP.Core.Auth
Assembly: PnP.Core.Auth.dll
Syntax
public class DeviceCodeAuthenticationProvider : OAuthAuthenticationProvider, IAuthenticationProvider
Constructors
DeviceCodeAuthenticationProvider(ILogger<OAuthAuthenticationProvider>, IMsalHttpClientFactory)
Public constructor leveraging DI to initialize the ILogger and IMsalHttpClientFactory interfaces
Declaration
public DeviceCodeAuthenticationProvider(ILogger<OAuthAuthenticationProvider> logger, IMsalHttpClientFactory msalHttpClientFactory)
Parameters
ILogger<OAuthAuthenticationProvider>
logger
The instance of the logger service provided by DI |
IMsalHttpClientFactory
msalHttpClientFactory
The 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
Declaration
public DeviceCodeAuthenticationProvider(string clientId, string tenantId, PnPCoreAuthenticationDeviceCodeOptions options, Action<DeviceCodeNotification> deviceCodeVerification)
Parameters
System.String
clientId
The Client ID for the Authentication Provider |
System.String
tenantId
The Tenant ID for the Authentication Provider |
PnPCoreAuthenticationDeviceCodeOptions
options
Options for the authentication provider |
Action<DeviceCodeNotification>
deviceCodeVerification
External action to manage the Device Code verification |
DeviceCodeAuthenticationProvider(String, String, Uri, Action<DeviceCodeNotification>)
Public constructor for external consumers of the library
Declaration
public DeviceCodeAuthenticationProvider(string clientId, string tenantId, Uri redirectUri, Action<DeviceCodeNotification> deviceCodeVerification)
Parameters
System.String
clientId
The Client ID for the Authentication Provider |
System.String
tenantId
The Tenant ID for the Authentication Provider |
Uri
redirectUri
The Redirect URI for the authentication flow |
Action<DeviceCodeNotification>
deviceCodeVerification
External action to manage the Device Code verification |
Properties
DeviceCodeVerification
Action to notify the end user about the device code request
Declaration
public Action<DeviceCodeNotification> DeviceCodeVerification { get; set; }
Property Value
Action<DeviceCodeNotification>
|
RedirectUri
The Redirect URI for the authentication flow
Declaration
public Uri RedirectUri { get; set; }
Property Value
Uri
|
Methods
AuthenticateRequestAsync(Uri, HttpRequestMessage)
Authenticates the specified request message.
Declaration
public override async Task AuthenticateRequestAsync(Uri resource, HttpRequestMessage request)
Parameters
Uri
resource
Request uri |
HttpRequestMessage
request
The |
Returns
Task
The task to await. |
Overrides
GetAccessTokenAsync(Uri)
Gets an access token for the requested resource
Declaration
public override async Task<string> GetAccessTokenAsync(Uri resource)
Parameters
Uri
resource
Resource to request an access token for |
Returns
Task<System.String>
An access token |
Overrides
GetAccessTokenAsync(Uri, String[])
Gets an access token for the requested resource and scope
Declaration
public override async Task<string> GetAccessTokenAsync(Uri resource, string[] scopes)
Parameters
Uri
resource
Resource to request an access token for (unused) |
System.String[]
scopes
Scopes to request |
Returns
Task<System.String>
An access token |