Hi All,
I am using Client Credential Method.
I having error:-
(index):1 Access to fetch at 'https://login.microsoftonline.com/xxxxxxxxxxxx-xxxxxxxxx-xxxx-xxxx-xxxxxxxxxx/oauth2/token' from origin 'https://xxxx.azurewebsites.net' 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.
May I know what wrong?
Startup.cs
services.AddCors(options =>
{
options.AddPolicy("SiteCorsPolicy", builder => builder
.WithOrigins(
"http://localhost:8080",
"https://localhost:8080",
"http://localhost:4200",
"https://localhost:4200",
"https://xxx.azurewebsites.net")
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});
app.UseCors("SiteCorsPolicy");
portal.azure.com >App Services > My Web API > Cors >[v tick] Enable Access-Control-Allow-Credentials
Allowed Origin: I added:-
Please advise. What's is the step missing.
Thanks
Regards,
Micheale