Apologize for the noob question. Just beginning to learn servicestack. I'm using a self-hosted console application with Razor for my view engine, the "RegistrationFeature" plugin for registrations and CredentialsAuthProvider for authentication via form post to allow users to login.
The SocialBootStrap application uses MVC 3 and does a "FormsAuthentication.SignOut()" to allow users to logout. Given that I'm using a self hosted application, I created a LogoutService that simply does a Request.RemoveSession() and that appears to work.
Is this the right way to log out a user's session ?
There is an explicit logout service i.e. /auth/logout
as part of the ServiceStack's Authentication support that you should use instead.
You can do a GET or POST to /auth/logout
or if you're using C# client you can logout with:
client.Post(new Authenticate { provider = "logout" });
On ServiceStack v4 you will need this line instead.
client.Post(new Authenticate { provider = AuthenticateService.LogoutAction });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With