From f1da6096bc9b23aa78a99dfc4c010955cc8804b3 Mon Sep 17 00:00:00 2001 From: Omar Oughriss Date: Mon, 20 Oct 2025 11:42:32 +0200 Subject: [PATCH] Set pairingId while requesting link --- lib/4nk/MessageBus.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/4nk/MessageBus.ts b/lib/4nk/MessageBus.ts index 9f3d5a1..adae0ff 100644 --- a/lib/4nk/MessageBus.ts +++ b/lib/4nk/MessageBus.ts @@ -61,8 +61,19 @@ export default class MessageBus { } unsubscribe(); this.destroyMessageListener(); + + // Connect with tokens first UserStore.getInstance().connect(accessToken, refreshToken); - resolve(); + + // Then get and set the pairing ID + this.getUserPairingId().then((pairingId: string) => { + UserStore.getInstance().pair(pairingId); + resolve(); + }).catch((error: string) => { + console.error('Failed to get pairing ID after authentication:', error); + // Still resolve since the main authentication succeeded + resolve(); + }); }); const unsubscribeError = EventBus.getInstance().on('ERROR_LINK_ACCEPTED', (responseId: string, error: string) => {