diff --git a/src/sync-plugins/keel.ts b/src/sync-plugins/keel.ts index d24d4ed8..ce4fabb7 100644 --- a/src/sync-plugins/keel.ts +++ b/src/sync-plugins/keel.ts @@ -95,6 +95,7 @@ export interface SyncedKeelConfiguration action: string; error: APIResult['error']; }) => void; + refreshAuth?: () => void | Promise; } interface PageInfo { @@ -176,6 +177,11 @@ const isEnabled$ = observable(true); async function ensureAuthToken() { await when(isEnabled$.get()); + + if (keelConfig.refreshAuth) { + await keelConfig.refreshAuth(); + } + let isAuthed = await keelConfig.client.auth.isAuthenticated(); if (!isAuthed) { isAuthed = await keelConfig.client.auth.refresh();