@axway/api-builder-plugin-dc-mbs
Version:
Mobile Backend Services connector
27 lines (23 loc) • 760 B
JavaScript
function disconnect(next) {
this.logger.trace('MBS.disconnect');
// Stop trying to keep the session alive
clearInterval(this.keepAlive);
// MBS sessions cookies are long-lived (3 months of inactivity).
// Logout to kill the session and stop it persisting on MBS servers.
// https://docs.appcelerator.com/arrowdb/latest/#!/guide/rest
this.db.usersLogout((err) => {
// We don't care if this fails. The server is shutting down
// so there may be more important things to handle.
if (err) {
// Do not expose `err` via callback (information disclosure)
this.logger.trace('MBS error logging out', err);
} else {
this.logger.trace('MBS successfully logged out');
}
delete this.db;
next(null);
});
}
module.exports = {
disconnect
};