I have a node-red-dashboard app that I would like to log out of. I have setup settings.js for adminAuth, httpNodeAuth, and https key/cert. I'm using a template and would like to include a logout button. I've tried:
scope.logOut = function() {
$.ajax({
type: "GET",
url: '/ui',
dataType: 'json',
async: true,
username: "logout",
password: "logout",
data: '{ "comment" }'
})
//In our case, we WANT to get access denied, so a success would be a failure.
.done(function(){
alert('Error!')
})
//Likewise, a failure *usually* means we succeeded.
//set window.location to redirect the user to wherever you want them to go
.fail(function(){
window.location = "/ui";
});
}
This will reprompt for username and password but if I just hit the back button I'm back in the app without logging in. I was to be completely logged out and cross browser effective.