Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cors problem trying to call secured web api #128

Open
lucamorelli opened this issue Jul 11, 2019 · 1 comment
Open

cors problem trying to call secured web api #128

lucamorelli opened this issue Jul 11, 2019 · 1 comment

Comments

@lucamorelli
Copy link

Hi,
I have an angular 7 app calling an aspnet (not core) application. the users logs correctly to azure ad from the client app, and make the call. I see that makes a few calls to azure validating the user, and after call the server api using cors. after this I see that the angular api makes another call to login.microsoftonline.com that dfails because of CORS

Access to XMLHttpRequest at 'https://login.microsoftonline.com/*****/oauth2/v2.0/authorize?client_id=*****&redirect_uri=http%3A%2F%2Flocalhost%3A2076%2F&response_mode=form_post&response_type=id_token&scope=openid%20profile&state=OpenIdConnect.AuthenticationProperties%3D7Sssc45y1RCdXNAFJEr2U26GtO-49sqL2tjTfuqYMWZ5bmGwL7rgoFLqKSa7Xq5-4eb6sQ6eETTFhnEmvmYzYM9JzlHZuo6qp-UNmTHtKFzdOJFfR2pMJsl109hgCLqY_n7wzByCq9p0THjitwdBqvlMEDI0yWNMubRYnTrRbZJ2Ltj7b-nrMOCc3_XAHclcdR3SeBhUzch6021fBcaiKQ&nonce=636984350242087681.MDA4ZGI3MzYtYmYzYS00NmM2LWE2MzgtZTM1NzYyYTI4MzQ1OWUzODQ4MTktNTk3Ni00MGJkLWE2MGMtYjg2ZWM4OGZjM2Y3&x-client-SKU=ID_NET461&x-client-ver=5.3.0.0' (redirected from 'http://localhost:2076/api/Claims') 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.

How can I solve this problem?

@CreativeAcer
Copy link
Contributor

Hi, are both your applications running on Azure with cors setup correctly? Make sure to add your endpoint to the environment file:
endpoints: {
'aspnet url': 'reg id aspnet'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants