skip to Main Content

C# – Asp.Net Core InvalidOperation Exception

Unable to resolve service for type 'AuthMicroservice.Repository.IAuthRepo' while attempting to activate 'AuthMicroservice.Controllers.AuthController'. at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired) at lambda_method4(Closure , IServiceProvider , Object[] ) at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass7_0.b__0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass6_0.g__CreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object&…

VIEW QUESTION

ASP.NET Core Sign In with JWT

im using JWT to Authentication, and I'm storing it in Cookies. I want to use HttpContext.SignInAsync to login, I saw a lot of example with basic Cookie Auth, but not with JWT. Here is my Startup.cs services.AddTransient<IUserRepository, UserRepository>(); services.AddTransient<ITokenService, TokenService>();…

VIEW QUESTION

ASP .NET Core Log Out from JWT – Asp.net

I logged in with JWT, but how can I log out? Without Token invalidation. I want to do it with button [AllowAnonymous] [Route("login")] [HttpPost] public IActionResult Login(LoginModel loginModel) { if (string.IsNullOrEmpty(loginModel.UserName) || string.IsNullOrEmpty(loginModel.Password)) { return (RedirectToAction("Error")); } IActionResult response =…

VIEW QUESTION
Back To Top
Search