Table of Contents

Class OAuthAuthenticationProvider

Namespace
PnP.Core.Auth
Assembly
PnP.Core.Auth.dll

Base authentication provider class

public abstract class OAuthAuthenticationProvider : IAuthenticationProvider
Inheritance
OAuthAuthenticationProvider
Implements
Derived
Inherited Members

Constructors

OAuthAuthenticationProvider(ILogger<OAuthAuthenticationProvider>)

Public constructor for any OAuth Authentication privider

public OAuthAuthenticationProvider(ILogger<OAuthAuthenticationProvider> logger)

Parameters

logger ILogger<OAuthAuthenticationProvider>

Properties

ClientId

The ClientId of the application to use for authentication

public string ClientId { get; set; }

Property Value

string

ConfigurationName

The Name of the configuration for the Authentication Provider

public string ConfigurationName { get; set; }

Property Value

string

TenantId

The Tenant ID for the application, default value is "organizations" for multi-tenant applications

public string TenantId { get; set; }

Property Value

string

Methods

AuthenticateRequestAsync(Uri, HttpRequestMessage)

Authenticates the specified request message.

public abstract Task AuthenticateRequestAsync(Uri resource, HttpRequestMessage request)

Parameters

resource Uri

Request uri

request HttpRequestMessage

The HttpRequestMessage to authenticate.

Returns

Task

The task to await.

GetAccessTokenAsync(Uri)

Gets an access token for the requested resource

public abstract Task<string> GetAccessTokenAsync(Uri resource)

Parameters

resource Uri

Resource to request an access token for

Returns

Task<string>

An access token

GetAccessTokenAsync(Uri, string[])

Gets an access token for the requested resource and scope

public abstract Task<string> GetAccessTokenAsync(Uri resource, string[] scopes)

Parameters

resource Uri

Resource to request an access token for

scopes string[]

Scopes to request

Returns

Task<string>

An access token