Base solution for your next web application
Open Closed

Access WebApi from Angular-App without using proxy-service class #11344


User avatar
0
geoteam created

What is your product version? 11.4.0 RC1 What is your product type (Angular or MVC)? Angular What is product framework type (.net framework or .net core)? .NET 6

Hi, we are using an Angular-Module that requires raw Html-Links to our WebApi. When we try to use the raw link to the WebApi-methode the request will be redirected to the login page, since the user isn't authenticated because of the missing token. Since the servers WebApi is hosted under a different domain (http://localhost:44301) then the client-application (http://localhost:4200) there isn't even an authentication cookie for this domain. We are aware of using the AbpAllowAnonymous decorator attribute to allow anonymous access to the WebApi. But in our methode we have to use the tenantId which isn't set since we are not authorized.

What is the correct way to request the WebApi directly with authorization information.

Thanks


1 Answer(s)