Good afthernoon

I have a project in sharepoint framework and a Web API project with Azure AD authentication.

In the API I have a controller with Autorize Attribute.

If the WEB API runs in localhost, when spfx call Web API Method using AadClient the server response is Access to fetch at 'https://login.microsoftonline.com/common/oauth2/authorize?client_id=.....' (redirected from 'https://localhost:44374/api/TestController') from origin 'null' 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. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled..

If the SPFX calls the same WEB API, but runs on Azure it works, but the local does not work.

I appreciate a lot if someone can help me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.