skip to Main Content

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

Call two actions from Html.BeginForm ASP.NET MVC

So the first action would be: @using (Html.BeginForm("Edit", "Post", FormMethod.Post, new { enctype = "multipart/form-data" })) and the second would be a ajax call: <input type="submit" value="Save" onclick="deleteImages()" class="btn btn-default" /> Ajax: <script> let deletedImages = []; function Remove(id, e)…

VIEW QUESTION
Back To Top
Search