C
C#12mo ago
FoxySnake

❔ Can't get Cookies Response from .net api

Hi, I figure how to get my auth cookie from the result of the Login of my Controller. I use Asp.net Identity to login my User. Here a shortcut of my endpoints to login my User and The cookie I get on the brower on the response. I wan't to include it on my "LoginResult". Ty for the help 🙂
No description
No description
7 Replies
Angius
Angius12mo ago
Why do you need to get it manually? The auth middleware should just use it and that's it
FoxySnake
FoxySnake12mo ago
Cause I have an angular application for the front of my website and the cookie give by Identity can't be catch with javascript so I need to catch it after the successfull login and add him to the response to store it on my localstorage. The principal reason I wan't to do that is to make the website remeber the user connected after his closure by storing it on the localstorage. Like that I when the user has check the "Remember Me", the website already know the user even after his closure until the user disconnect by himself
Angius
Angius12mo ago
You can still use the auth middleware for that Just set the cookie to not expire too soon
FoxySnake
FoxySnake12mo ago
Yes but how the front part of my website is supposed to know if the user who had connection before the closure is supposed to be logged or not ?
Angius
Angius12mo ago
The requests sent to the backend will go through That will mean the user is authenticated and logged in
FoxySnake
FoxySnake12mo ago
Ok I will check this. Maybe I just doesn't know the middleware for this thing. Tu for the help
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server