✅ ASP.NET EFC MVC deletes authentication cookie after next request.
I've been having this issue that my asp.net app is deleting the login cookie right next request after it set it.
When i post to /login i get this response header:
After that it redirects me to /me page and /me page responds with this header (It unsets the cookie)
I have no clue why it does that.
Please help me
12 Replies
Btw here is the full code
let's see your config for the auth middleware
GitHub
TheSKZWeb/TheSKZWeb/Program.cs at main · philskillz-coder/TheSKZWeb
Contribute to philskillz-coder/TheSKZWeb development by creating an account on GitHub.
GitHub
TheSKZWeb/TheSKZWeb/AuthorizationPolicies/PermissionPolicy.cs at ma...
Contribute to philskillz-coder/TheSKZWeb development by creating an account on GitHub.
GitHub
TheSKZWeb/TheSKZWeb/Middleware/LoginManagerMiddleware.cs at main · ...
Contribute to philskillz-coder/TheSKZWeb development by creating an account on GitHub.
also the repo was private now its public
what's your intention for having both JWT and Cookie authentication configured? I'll wager that's where the issue's coming from
the login action sets a cookie for cookie scheme, but what's triggering the auth failure is the bearer scheme
set some breakpoints in that
ForwardDefaultSelector
delegate, and see if it's behaving the way you intendI had this jwt and cookie configuration already when I created my original app a year ago. Now Im using it again and it does not work
Will try the breakpoint but I didn't understand where you meant to place it. Can you explain it again please?
omfg
i so stupid
it signs out if users dont have permission
but this permission does not exist and it returns false
inside the ForwardDefaultSelector delegate
Ok I fixed it
sweet
How do I close this ticket?