I have an identity server 4 application, with a JavaScript client, and several asp .net core clients.
The JavaScript client was created using Adding a JavaScript client.
I have implemented back channel logout on the asp .net core apps. So that when one logs out then they all log themselves out. The problem i am having is with the JavaScript app. I dont see how back channel logout would work with that. The only thing i have been able to think of is to have the following code just check the server every minute look to see if the user is still logged in. But that sounds like a lot of calls to the identity server.
function login() {
mgr.signinRedirect();
}
function api() {
mgr.getUser().then(function (user) {
var url = "http://localhost:5001/identity";
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.onload = function () {
log(xhr.status, JSON.parse(xhr.responseText));
}
xhr.setRequestHeader("Authorization", "Bearer " + user.access_token);
xhr.send();
});
}
function logout() {
mgr.signoutRedirect();
}
Is there a way to implement single signout / back channel logout on a JavaScript client side app?