OneNote API authProvider Error

  • Thread starter Thread starter fswitz
  • Start date Start date
F

fswitz

Guest
According to this webpage:

Create Notebook Create notebook - Microsoft Graph v1.0

A request to create a notebook uses the following code:

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var notebook = new Notebook
{
DisplayName = "Notebook name"
};

await graphClient.Me.Onenote.Notebooks
.Request()
.AddAsync(notebook);

I want to try this code but cannot find a authProvider

Here is the code Im using.


private async void GetTokenAndProvider()
{
string[] scopes = new string[] { "user.read" };
var app = PublicClientApplicationBuilder.Create(ClientId).Build();
var accounts = await app.GetAccountsAsync();
AuthenticationResult result;
try
{
result = await app.AcquireTokenSilent(scopes, accounts.FirstOrDefault())
.ExecuteAsync();
}
catch (MsalUiRequiredException)
{
result = await app.AcquireTokenInteractive(scopes)
.ExecuteAsync();
}

IPublicClientApplication publicClientApplication = PublicClientApplicationBuilder
.Create(ClientId)
.Build();

InteractiveAuthenticationProvider authenticationProvider = new InteractiveAuthenticationProvider(publicClientApplication, scopes);

}


How, where do I find InteractiveAuthenticationProvider ? I have searched everywhere.




Fritz Switzer

Continue reading...
 
Back
Top