[Authority] field ignored - Authentication Fails for enterprise tenant with BotAuth.AADv2
I am building a bot App that connects to my enterprise O365 tenant. When using BotAuth.AADv2 to authenticate I get the a response from Azure that my app can't use the common endpoint and I should use my tenant endpoint.
I specified my tenant "Authority" endpoint in the "AuthenticationOptions" to be my tenant: https://login.microsoftonline.com/{tenantId}/oauth2/token but the authentication still fails
I traced the code and the problem is not passing the "Authority" parameter to the "ConfidentialClientApplication" in the MSALAuthProvider
I updated the following two lines to make it work: Line 57-58:
ConfidentialClientApplication client = new ConfidentialClientApplication(authOptions.ClientId,
**authOptions.Authority**, redirectUri.ToString(), new ClientCredential(authOptions.ClientSecret),
tokenCache, null);
Line 67-68:
ConfidentialClientApplication client = new ConfidentialClientApplication(authOptions.ClientId,
**authOptions.Authority**, authOptions.RedirectUrl, new ClientCredential(authOptions.ClientSecret),
tokenCache, null);
I can submit a pull request if you like.
Ah thanks for confirming this. Explains the issue I was having.