Skip to content
This repository was archived by the owner on Dec 9, 2020. It is now read-only.
This repository was archived by the owner on Dec 9, 2020. It is now read-only.

[Authority] field ignored - Authentication Fails for enterprise tenant with BotAuth.AADv2 #46

@Zaid-Safadi

Description

@Zaid-Safadi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions