Custom Authentication Function
Docs
For more control, use a custom authentication function:
const bshEngine = new BshEngine({
host: 'https://your-instance.com',
authFn: async () => {
// Get token from wherever you store it
const token = localStorage.getItem('accessToken');
if (!token) return null;
return { type: 'JWT', token: token};
}
})This allows you to dynamically retrieve tokens from any storage mechanism (localStorage, sessionStorage, cookies, secure storage, etc.).