I have created a bot in c#.net and deployed that bot in teams, I want to conference booking in bot by using graph API, so which auth provider should I create?

Now the Microsoft.Graph.Auth library has been marked as deprecated, so the accepted answer maybe is not valid anymore for someone (like me).
Now you need to use Azure.Identity Nuget package and InteractiveBrowserCredential instead of InteractiveAuthenticationProvider.
Example using Microsoft.Graph.Auth (DEPRECATED NOW):
string[] scopes = {"User.Read"};
IPublicClientApplication publicClientApplication = PublicClientApplicationBuilder
.Create(clientId)
.Build();
InteractiveAuthenticationProvider authProvider = new InteractiveAuthenticationProvider(publicClientApplication, scopes);
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
User me = await graphClient.Me.Request()
.GetAsync();
Example using TokenCredential class
string[] scopes = {"User.Read"};
InteractiveBrowserCredentialOptions interactiveBrowserCredentialOptions = new InteractiveBrowserCredentialOptions() {
ClientId = clientId
};
InteractiveBrowserCredential interactiveBrowserCredential = new InteractiveBrowserCredential(interactiveBrowserCredentialOptions);
GraphServiceClient graphClient = new GraphServiceClient(interactiveBrowserCredential, scopes); // you can pass the TokenCredential directly to the GraphServiceClient
User me = await graphClient.Me.Request()
.GetAsync();
Examples are taken from: https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/upgrade-to-v4.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With