I’m looking to use client-side authorization via Auth0. Check out this minimal demo to see what the issue is. Here’s the event handler I’ve installed:
document.documentElement.addEventListener(
"turbo:before-fetch-request",
event => {
console.log(event)
if (token) {
event.detail.fetchOptions.headers["Authorization"] = `Bearer ${token}`;
}
}
);
I’m populating token
when the user logs in, and calling Turbo.clearCache()
to re-fetch all visible content. However, I’m not seeing anything load, and there are no error messages either. What am I doing wrong?