question

PAbhishekRao-8846 avatar image
0 Votes"
PAbhishekRao-8846 asked ·

SSO login Issue with Azure AD in .net core with Angular application

I downloaded a sample .net core code for SSO login from MS documents and did all necessary change related to Tenant and client ID. After change AAD Login is working properly. Now I have my application in .net core with angular. I did all the changes in Startup.cs and appsettings.json as instructed. But there it is not working, when I try to find out the error I found there are CORS error in console tab. After R&D I added below code to startup.cs to overcome the cors issue but it is now not solving. Please guide me to how can we workout the AAD Login (SSO) in .net core with angular application. services.

AddCors(options => { options.AddPolicy("AllowAllHeaders", builder => { builder.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod(); }); }); app.UseRouting(); app.UseCors("AllowAllHeaders"); //THIS HAS TO BE ADD FOR SESSION VARIABLE app.UseSession(); app.UseAuthentication(); app.UseAuthorization();

azure-ad-openid-connect
· 3
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Which error are you seeing and which guide are you following?

0 Votes 0 ·

Hi Marilee,

I followed following guide from MS DOC. My application is of Asp.net core 3.1 with Angular 8
https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-v2-aspnet-core-webapp
Error :
Access to XMLHttpRequest at 'https://login.microsoftonline.com/a23c8d81-5b0e-481c-96e2-cb6a527e96d1/oauth2/v2.0/authorize?client_id=xxx&redirect_uri=xxx&response_type=id_token&scope=openid%20profile&response_mode=form_post&nonce=xxxxx&client_info=1&x-client-brkrver=IDWeb.1.6.0.0&state=xxxxclient-SKU=ID_NETSTANDARD2_0&x-client-ver=5.5.0.0' (redirected from 'https://localhost:44360/Admin/UserLogin') from origin 'https://localhost:44360' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

0 Votes 0 ·

Hi Marilee,

Please can you help on this.


I followed following guide from MS DOC. My application is of Asp.net core 3.1 with Angular 8
https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-v2-aspnet-core-webapp
Error :
Access to XMLHttpRequest at 'https://login.microsoftonline.com/a23c8d81-5b0e-481c-96e2-cb6a527e96d1/oauth2/v2.0/authorize?client_id=xxx&redirect_uri=xxx&response_type=id_token&scope=openid%20profile&response_mode=form_post&nonce=xxxxx&client_info=1&x-client-brkrver=IDWeb.1.6.0.0&state=xxxxclient-SKU=ID_NETSTANDARD2_0&x-client-ver=5.5.0.0' (redirected from 'https://localhost:44360/Admin/UserLogin') from origin 'https://localhost:44360' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

0 Votes 0 ·

0 Answers