Skip to content

Commit f1ecfaa

Browse files
committed
fix(clerk-js): Handle gracefully Coinbase Wallet initial configuration
There is a chance that as a first time visitor when you try to setup and use the Coinbase Wallet from scratch in order to authenticate, the initial generate signature request to be rejected. For this reason we retry the request once more in order for the flow to be able to be completed successfully.
1 parent c906385 commit f1ecfaa

File tree

1 file changed

+15
-1
lines changed
  • packages/clerk-js/src/core/resources

1 file changed

+15
-1
lines changed

packages/clerk-js/src/core/resources/SignUp.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,21 @@ export class SignUp extends BaseResource implements SignUpResource {
207207
clerkVerifyWeb3WalletCalledBeforeCreate('SignUp');
208208
}
209209

210-
const signature = await generateSignature({ identifier, nonce, provider });
210+
let signature: string;
211+
try {
212+
signature = await generateSignature({ identifier, nonce, provider });
213+
} catch (err) {
214+
// There is a chance that as a first time visitor when you try to setup and use the
215+
// Coinbase Wallet from scratch in order to authenticate, the initial generate
216+
// signature request to be rejected. For this reason we retry the request once more
217+
// in order for the flow to be able to be completed successfully.
218+
if (provider === 'coinbase_wallet' && err.message === 'Request rejected') {
219+
signature = await generateSignature({ identifier, nonce, provider });
220+
} else {
221+
throw err;
222+
}
223+
}
224+
211225
return this.attemptWeb3WalletVerification({ signature, strategy });
212226
};
213227

0 commit comments

Comments
 (0)