Skip to content

alternative to authUrl to pass in promise of auth token request #1974

@smblee

Description

@smblee

hello, I would love an option to pass in a new onAuthRequest prop or change the authCallback to accept async functions

new Ably.Realtime({
  onAuthRequest: async () => { 
    await ensureAuthRefreshed();
    const res = await myApiClient.getAblyToken();

   return res.result.data;
  }
})

I think the current authCallback is super limited/clunky since its only synchronous.

This would also allow for ease of use for people who use trpc since it by default returns a nested data shape (res.result.data.json would be where the result is stored).

Issue is synchronized with this Jira Task by Unito

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions