Reputation: 25
ServiceStack add information to logout response status
Upvotes: 1
Views: 104
Reputation: 143319
You can specify a relative url to redirect to by specifying ?continue
on the queryString, e.g:
/auth/logout?continue=/logout-success
which will redirect to example.org/logout-success
page which you can implement as normal.
Rather than specifying it on the queryString you can force it to redirect to a specific url by overriding the LogoutUrlFilter
, e.g:
Plugins.Add(new AuthFeature(...,
new IAuthProvider[] {
new CredentialsAuthProvider {
LogoutUrlFilter = (auth, url) => "/logout-success"
},
});
Another option is to logout with Ajax which gives you more flexibility, e.g. you can notify the user logged out on the same page (i.e. without redirecting):
$.getJSON("/auth/logout", function () {
$("#status").html("You successfully Signed out");
});
Upvotes: 1