I am currently working on an Angular application with a .NET Core web API. The initial request is made to a /token service, but I keep encountering a CORS error despite having it enabled. What could be missing in my setup?
:8088/#/home:1 XMLHttpRequest cannot load http://example.com:90/api/token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com:8088' is therefore not allowed access.
public partial class Startup
{
// Configuration setup
}
Within my Angular application, here is a snippet from LoggingService.js:
angular
.module('common.services')
.factory('loginservice', ['$http', 'appSettings', loginservice]);
// Login service implementation
And here is a part of LoginController.js within the same Angular app:
app.controller('logincontroller', ['$scope', 'loginservice', 'userProfile', '$rootScope', logincontroller]);
// Login controller functionality
More information about token authentication in ASP.NET Core can be found here.