Skip to content

Auth

A guest only has a guestHash. To gate an action behind login, open sign-up and wait for the context to update. In the snippets, ext is your createExtHelper() instance.

From guest to signed-in user

ts
const ctx = await ext.makeRequest('v1.ext.context.get', null);
if (ctx.user?.isGuest) {
  await ext.makeRequest('v1.ext.signup.open', { type: 'user' });
  // no completion callback — watch the context
  ext.subscribe('v1.ext.context.updated', ({ context }) => {
    if (context.user && !context.user.isGuest) yourEnablePaidActions();
  });
} else {
  yourEnablePaidActions();
}

TIP

There is no "sign-up finished" callback — subscribe to v1.ext.context.updated once and react when context.user is no longer a guest.