Hi all,
I was trying to use the web.public project to host the Angular 4 SPA and ran into a few issues. The template I downloaded was ASPNet Core & Angular 4.4.0.
First problem was that I encountered the following error in the log file when I tried to login:
...
Service 'xxxx.Web.Authentication.JwtBearer.TokenAuthConfiguration' which was not registered.
Castle.MicroKernel.Handlers.HandlerException: Can't create component 'xxx.Web.Controllers.TokenAuthController' as it has dependencies to be satisfied.
...
So I added the following line in the startup.cs:
app.ApplicationServices.GetRequiredService<TokenAuthConfiguration>();
The error message changed to:
Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service xxx.Web.Authentication.JwtBearer.TokenAuthConfiguration was found
I am not sure how to proceed. What do I miss?
Thank you in advance!
derek
2 Answer(s)
-
0
I found out what the problem is. I need to copy the JwtBearer setting from host to public project. I ran into next problem.
...idateAntiforgeryTokenAuthorizationFilter - Antiforgery token validation failed. The required antiforgery header value "Public-X-XSRF-TOKEN" is not present.
-
0
Hi @BCAA4567,
Do you use cshtml files or html files for your angularJS app ? If it is cshtml, then you need to add below code to your layout cshtml file.
@{ SetAntiForgeryCookie(); }
If you are using html, then you need to include this header to your ajax requests. You can get anti forgery token value using below code.
abp.security.antiForgery.getToken()
Thanks.