I`m using the FIN Messenger in a test website. The frontend always call to call to Intercom('shutdown') and Intercom('boot’) on page load. Before that, we get the JWT form our backend an send that to the messenger throught the API. That works well.
The problem is when the user logs out of our backend, reloading the page still shows the conversation of the user who logged out.
As if Intercom('shutdown'); and Intercom('boot', config); weren't working.
function bootIntercom(config) {
if (window.Intercom) {
window.Intercom('shutdown');
}
window.Intercom('boot', config);
}
(async () => {
const status = document.getElementById('statusContainer');
try {
const res = await fetch('https://REDACTED/autenticar', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include'
});
const data = await res.json();
if (res.ok && data.success && data.token) {
status.innerText = ` Autenticado como ${data.payload.user_first_name}`;
bootIntercom({
api_base: "https://api-iam.intercom.io",
app_id: "REDACTED",
intercom_user_jwt: data.token,
session_duration: 86400000
});
} else {
status.innerText = ' Sesión no iniciada. Modo visitante.';
bootIntercom({
api_base: "https://api-iam.intercom.io",
app_id: "REDACTED"
});
}
} catch {
status.innerText = ' Error al verificar sesión';
bootIntercom({
api_base: "https://api-iam.intercom.io",
app_id: "REDACTED"
});
}
})();