abp icon indicating copy to clipboard operation
abp copied to clipboard

The "How to Use the Azure Active Directory Authentication" does not mention AzureAd:ClientSecret

Open Stirda opened this issue 6 years ago • 6 comments

I followed https://github.com/abpframework/abp/blob/1e5f9111fde5bb7750ffdd53b11dbaef9207f3b7/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md but it is never mentionned that you need to give options.ClientSecret a value in order to succeed. It may be tough to find that this is what you have to add, because some web articles send you to another hypothesis (Azure AD App Registration configuration public/mobile vs confidential/webapp) .

Stirda avatar May 05 '20 17:05 Stirda

Was here some time but removed here : https://github.com/abpframework/abp/commit/a3e990e33585f234cbafed9e071db2cff8ee4fdd

Stirda avatar May 05 '20 17:05 Stirda

@Stirda Please see my repo for an working example application with Azure AD: https://github.com/Znow/AbpAzureAdLogin

Znow avatar May 05 '20 17:05 Znow

@Znow By following ABP tutorial and adding options.ClientSecret, all already work great. Thank you.

Stirda avatar May 06 '20 11:05 Stirda

@Stirda Hello, You are right it has been removed since it is related with user's preference of using AzureAD certificate.

Actually it is out of framework's boundry and i didn't want to bother users with certifacates and secrets since its all about AzureAD.

As a matter of fact, only difference between AzureAD integration with a .net core app and abp application is; requesting extra scope and setting external signin scheme.

But I think we can mention about it on FAQ side of the guide. Can you paste the error you had when not using certificate and not using client secret?

gterdem avatar May 07 '20 22:05 gterdem

I think this was:

AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'

Note that many articles, like this one, make you believe that your Azure application registration is wrong. This is what made me lose some time.

Stirda avatar May 08 '20 07:05 Stirda

@Stirda Ok, now i figured it out. You requested code (authorization code) with id_token. That's why you are required to have client_secret or client_assertion.

So your options.ResponseType is not OpenIdConnectResponseType.IdToken but something like OpenIdConnectResponseType.CodeIdToken right?

Now it is all about OpenId specs and how openid providers (like AzureAd) implement it. It is hard to draw boundry lines.

We wanted to keep AzureAD integration as simple as it can be without diving into details. Nevertheless, I will enhance the docs about it to prevent users get drowned in web about authentication specs. Thank you.

gterdem avatar May 08 '20 09:05 gterdem