We are using a multi tenant application.
App registration is created in Tenant A and the same bot application is used by Tenant B customers also.
So we want to use the same app registration for Tenant B also to send email.
It was working till the graph client version 4 using the sign in process. We will get the token when user sign in and if its a different tenant user, then it will ask for accepting the app registration and valid token will be created.
We have used the same token to create the graph client in the latest nuget version and we were getting unauthorized error
Same can we achieve using the application permission
Or can we use the below code in the document, https://learn.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=csharp#on-behalf-of-provider
// Multi-tenant apps can use "common",
// single-tenant apps must use the tenant ID from the Azure portal
var tenantId = "common";
// Value from app registration
var clientId = "YOUR_CLIENT_ID";
var authenticationProvider = new BaseBearerTokenAuthenticationProvider(
new IntegratedWindowsTokenProvider(clientId, tenantId));
var graphClient = new GraphServiceClient(authenticationProvider);
return graphClient;