From f13630d73b2cc0ec3de320885ddb4abb98bfadbc Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 8 May 2020 13:34:55 +0300 Subject: [PATCH 1/6] Update Azure-Active-Directory-Authentication-MVC.md added azureAD 2 more error solutions on FAQ --- ...ure-Active-Directory-Authentication-MVC.md | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md index 10b1e05a4a..1e61ac7632 100644 --- a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md +++ b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md @@ -171,19 +171,32 @@ You can find the source code of the completed example [here](https://github.com/ your **Redirect URI** of your application in azure portal must be with domain like `https://localhost:44320/signin-azuread-oidc`, not only `/signin-azuread-oidc`. +* Help! I keep getting ***AADSTS700051: The response_type 'token' is not enabled for the application.*** error! + + * This error occurs when you request **token** (access token) along with **id_token** without enabling Access tokens on Azure portal app registrations. Simply tick **Access tokens** checkbox located on top of ID tokens to be able to request token aswell. + * Help! I am getting ***System.ArgumentNullException: Value cannot be null. (Parameter 'userName')*** error! - * This occurs when you use Azure Authority **v2.0 endpoint** without requesting `email` scope. [Abp checks unique email to create user](https://github.com/abpframework/abp/blob/037ef9abe024c03c1f89ab6c933710bcfe3f5c93/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs#L208). Simply add - + * This occurs when you use Azure Authority **v2.0 endpoint** without requesting `email` scope. [Abp checks unique email to create user](https://github.com/abpframework/abp/blob/037ef9abe024c03c1f89ab6c933710bcfe3f5c93/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs#L208). Simply add + ````csharp options.Scope.Add("email"); ```` - + to your openid configuration. +* Help! I keep getting ***AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret*** error! + + * This error occurs when you request **code** along with **id_token**. You need to add **client secret** on azure portal app registrations, under **Certificates & secrets** menu. Afterwards, you need to add openid configuration option like: + + ````csharp + options.ClientSecret = "Value of your secret on azure portal"; + ```` + * How can I **debug/watch** which claims I get before they get mapped? + * You can add a simple event under openid configuration to debug before mapping like: ````csharp @@ -194,7 +207,6 @@ You can find the source code of the completed example [here](https://github.com/ }); ```` - ## See Also * [How to Customize the Login Page for MVC / Razor Page Applications](Customize-Login-Page-MVC.md). From 78bb3112cecf30c908be27d2a5c51cfa4bb6b2d5 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 8 May 2020 13:38:47 +0300 Subject: [PATCH 2/6] Update Azure-Active-Directory-Authentication-MVC.md clumped AzureAD errors --- ...ure-Active-Directory-Authentication-MVC.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md index 1e61ac7632..5891a764e0 100644 --- a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md +++ b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md @@ -158,6 +158,17 @@ You can find the source code of the completed example [here](https://github.com/ ```` +* Help! I am getting ***System.ArgumentNullException: Value cannot be null. (Parameter 'userName')*** error! + + +* This occurs when you use Azure Authority **v2.0 endpoint** without requesting `email` scope. [Abp checks unique email to create user](https://github.com/abpframework/abp/blob/037ef9abe024c03c1f89ab6c933710bcfe3f5c93/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs#L208). Simply add + + ````csharp + options.Scope.Add("email"); + ```` + + to your openid configuration. + * Help! I keep getting ***AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application*** error! * If you set your **CallbackPath** in appsettings as: @@ -175,17 +186,6 @@ You can find the source code of the completed example [here](https://github.com/ * This error occurs when you request **token** (access token) along with **id_token** without enabling Access tokens on Azure portal app registrations. Simply tick **Access tokens** checkbox located on top of ID tokens to be able to request token aswell. -* Help! I am getting ***System.ArgumentNullException: Value cannot be null. (Parameter 'userName')*** error! - - - * This occurs when you use Azure Authority **v2.0 endpoint** without requesting `email` scope. [Abp checks unique email to create user](https://github.com/abpframework/abp/blob/037ef9abe024c03c1f89ab6c933710bcfe3f5c93/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs#L208). Simply add - - ````csharp - options.Scope.Add("email"); - ```` - - to your openid configuration. - * Help! I keep getting ***AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret*** error! * This error occurs when you request **code** along with **id_token**. You need to add **client secret** on azure portal app registrations, under **Certificates & secrets** menu. Afterwards, you need to add openid configuration option like: From 497525d528a7fe7d0978ab5820e3a3f648787f33 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 8 May 2020 13:45:01 +0300 Subject: [PATCH 3/6] Update Azure-Active-Directory-Authentication-MVC.md empty space fix --- .../Azure-Active-Directory-Authentication-MVC.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md index 5891a764e0..349fd6ee68 100644 --- a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md +++ b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md @@ -158,15 +158,15 @@ You can find the source code of the completed example [here](https://github.com/ ```` -* Help! I am getting ***System.ArgumentNullException: Value cannot be null. (Parameter 'userName')*** error! +* Help! I am getting ***System.ArgumentNullException: Value cannot be null. (Parameter 'userName')*** error! * This occurs when you use Azure Authority **v2.0 endpoint** without requesting `email` scope. [Abp checks unique email to create user](https://github.com/abpframework/abp/blob/037ef9abe024c03c1f89ab6c933710bcfe3f5c93/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs#L208). Simply add - ````csharp - options.Scope.Add("email"); - ```` - + ````csharp + options.Scope.Add("email"); + ```` + to your openid configuration. * Help! I keep getting ***AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application*** error! From c2d06d734b7b901152129cca8fe6a5028f20f3e4 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 8 May 2020 13:53:19 +0300 Subject: [PATCH 4/6] Update Azure-Active-Directory-Authentication-MVC.md typora typos fix --- ...ure-Active-Directory-Authentication-MVC.md | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md index 349fd6ee68..428db9f4c0 100644 --- a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md +++ b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md @@ -1,3 +1,11 @@ + + + + + + + + # How to Use the Azure Active Directory Authentication for MVC / Razor Page Applications This guide demonstrates how to integrate AzureAD to an ABP application that enables users to sign in using OAuth 2.0 with credentials from **Azure Active Directory**. @@ -161,14 +169,14 @@ You can find the source code of the completed example [here](https://github.com/ * Help! I am getting ***System.ArgumentNullException: Value cannot be null. (Parameter 'userName')*** error! -* This occurs when you use Azure Authority **v2.0 endpoint** without requesting `email` scope. [Abp checks unique email to create user](https://github.com/abpframework/abp/blob/037ef9abe024c03c1f89ab6c933710bcfe3f5c93/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs#L208). Simply add + * This occurs when you use Azure Authority **v2.0 endpoint** without requesting `email` scope. [Abp checks unique email to create user](https://github.com/abpframework/abp/blob/037ef9abe024c03c1f89ab6c933710bcfe3f5c93/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs#L208). Simply add - ````csharp + ````csharp options.Scope.Add("email"); - ```` - - to your openid configuration. - + ```` + + to your openid configuration. + * Help! I keep getting ***AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application*** error! * If you set your **CallbackPath** in appsettings as: @@ -197,15 +205,15 @@ You can find the source code of the completed example [here](https://github.com/ * How can I **debug/watch** which claims I get before they get mapped? - * You can add a simple event under openid configuration to debug before mapping like: + * You can add a simple event under openid configuration to debug before mapping like: - ````csharp - options.Events.OnTokenValidated = (async context => - { - var claimsFromOidcProvider = context.Principal.Claims.ToList(); - await Task.CompletedTask; - }); - ```` + ````csharp + options.Events.OnTokenValidated = (async context => + { + var claimsFromOidcProvider = context.Principal.Claims.ToList(); + await Task.CompletedTask; + }); + ```` ## See Also From 8da0851b12718621e43d575cf201147d2bc55907 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 8 May 2020 14:00:31 +0300 Subject: [PATCH 5/6] Update Azure-Active-Directory-Authentication-MVC.md notepad fix of mistakes --- ...ure-Active-Directory-Authentication-MVC.md | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md index 428db9f4c0..8b31689795 100644 --- a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md +++ b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md @@ -1,11 +1,3 @@ - - - - - - - - # How to Use the Azure Active Directory Authentication for MVC / Razor Page Applications This guide demonstrates how to integrate AzureAD to an ABP application that enables users to sign in using OAuth 2.0 with credentials from **Azure Active Directory**. @@ -188,7 +180,7 @@ You can find the source code of the completed example [here](https://github.com/ } ```` - your **Redirect URI** of your application in azure portal must be with domain like `https://localhost:44320/signin-azuread-oidc`, not only `/signin-azuread-oidc`. + your **Redirect URI** of your application in azure portal must be with domain like `https://localhost:44320/signin-azuread-oidc`, not only `/signin-azuread-oidc`. * Help! I keep getting ***AADSTS700051: The response_type 'token' is not enabled for the application.*** error! @@ -204,16 +196,15 @@ You can find the source code of the completed example [here](https://github.com/ * How can I **debug/watch** which claims I get before they get mapped? + * You can add a simple event under openid configuration to debug before mapping like: - * You can add a simple event under openid configuration to debug before mapping like: - - ````csharp - options.Events.OnTokenValidated = (async context => - { - var claimsFromOidcProvider = context.Principal.Claims.ToList(); - await Task.CompletedTask; - }); - ```` + ````csharp + options.Events.OnTokenValidated = (async context => + { + var claimsFromOidcProvider = context.Principal.Claims.ToList(); + await Task.CompletedTask; + }); + ```` ## See Also From c93cb3500c801293ed579593781a364f0c81be05 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 8 May 2020 14:02:57 +0300 Subject: [PATCH 6/6] Update Azure-Active-Directory-Authentication-MVC.md empty space fix --- docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md index 8b31689795..434d5f8bac 100644 --- a/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md +++ b/docs/en/How-To/Azure-Active-Directory-Authentication-MVC.md @@ -163,9 +163,9 @@ You can find the source code of the completed example [here](https://github.com/ * This occurs when you use Azure Authority **v2.0 endpoint** without requesting `email` scope. [Abp checks unique email to create user](https://github.com/abpframework/abp/blob/037ef9abe024c03c1f89ab6c933710bcfe3f5c93/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs#L208). Simply add - ````csharp - options.Scope.Add("email"); - ```` + ````csharp + options.Scope.Add("email"); + ```` to your openid configuration.