Sync
Barq sync uses token-based users. Your app owns authentication.
Create a User
Section titled “Create a User”const user = Barq.User.fromToken(accessToken, { route: 'wss://your-sync-host/barq-sync',});accessToken should be signed by your identity provider. The Barq server verifies it.
Flexible Sync
Section titled “Flexible Sync”const barq = await Barq.open({ schema: [Task], sync: { user, flexible: true, initialSubscriptions: { update(subs, realm) { subs.add(realm.objects(Task)); }, }, },});Partition Sync
Section titled “Partition Sync”const barq = await Barq.open({ schema: [Task], sync: { user, partitionValue: 'shared', },});Token Refresh
Section titled “Token Refresh”When your auth service issues a new token:
user.setAccessToken(newAccessToken);