Skip to content

Commit 3347d1f

Browse files
committed
fix: await createIframe call
1 parent a257036 commit 3347d1f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/sdk/src/browser/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export class BrowserClient extends BaseClient {
190190
* });
191191
* ```
192192
*/
193-
public connectAccount(opts: StartConnectOpts) {
193+
public async connectAccount(opts: StartConnectOpts) {
194194
const onMessage = (e: MessageEvent) => {
195195
switch (e.data?.type) {
196196
case "success":
@@ -212,11 +212,11 @@ export class BrowserClient extends BaseClient {
212212
window.addEventListener("message", onMessage);
213213

214214
try {
215-
this.createIframe(opts);
215+
await this.createIframe(opts);
216216
} catch (err) {
217217
opts.onError?.(err as ConnectError);
218218
}
219-
this.refreshToken(); // token is used only once
219+
this.refreshToken(); // token expires once it's used to create a connected account. We need to get a new token for the next requests.
220220
}
221221

222222
/**

0 commit comments

Comments
 (0)