- Connection-only vs. sign-in
- Sign-in on Para’s updated authentication flow with
loginExternalWalletandcompleteExternalWalletLogin - Sign-in without the opt-in, with
loginExternalWalletandverifyExternalWallet
Prerequisites
Connection-only vs. Sign-in
There are two ways to tell Para about an external wallet:- Connection-only. Pass
isConnectionOnly: truein theexternalWallet. Para records the connected address for the session without signing the user in to a Para account. No signature is needed. - Sign-in. The user signs in to a Para account with the wallet. The wallet proves it controls the address by signing a sign-in message. On Para’s updated authentication flow this is a verify-only sign-in: Para doesn’t create an embedded Para wallet for the user, and the external wallet stays the user’s wallet.
Sign In on the Updated Authentication Flow (Recommended)
We recommend opting in to Para’s updated authentication flow with thesupportsAuthV2 option; it becomes the default in the next major version. Requires @getpara/react-native-wallet 3.23.0 or later. Once your app opts in (see ), sign-in takes two calls:
loginExternalWallet({ externalWallet, uri })opens the sign-in. Passuri, your app’s https origin (for example"https://yourapp.com"). Its domain is what the wallet shows the user in the sign-in message. On the updated flow the call throws without it, because a React Native app has no page origin to fall back on.completeExternalWalletLogin({ signMessage, sessionPollingCallbacks })asks yoursignMessagecallback to sign the sign-in message with the same wallet, verifies the signature, and resolves once the user is signed in. It returns the sameAuthenticateResponseasauthenticateWithEmailOrPhone.
loginExternalWallet returns an auth state with a stage, and you finish with verifyExternalWallet as shown in the next section. The example below handles both.
externalWalletLogin.ts
signMessagemust sign with the same wallet you passed tologinExternalWallet. Throw from it to cancel sign-in. For Cosmos wallets, return{ signature, cosmosSigner, cosmosPublicKeyHex }instead of a string.- A new user has no embedded Para wallet. A verify-only sign-in creates no Para wallet shares. Sign transactions with the external wallet.
- Failures reset the sign-in. If
completeExternalWalletLoginthrows, it cancels the pending sign-in, so the next attempt starts withloginExternalWalletagain. - Don’t set
withFullParaAuth. On the updated flow,loginExternalWalletrejects a wallet that sets it withFull-auth external wallet sign-in is not supported on React Native auth v2, before the wallet signs anything. - Connection-only wallets don’t use it.
loginExternalWalletconnects a connection-only wallet without a Para login, as before, and there’s nothing to complete. - Use
completeExternalWalletLogin, notverifyExternalWallet, on the updated flow.verifyExternalWalletthrows while an updated-flow sign-in is waiting for its signature.
Sign In Without the Opt-In
Without the opt-in, sign-in with an external wallet keeps working unchanged:- Call
loginExternalWallet({ externalWallet }). It returns an auth state with the message to sign insignatureVerificationMessage. - Sign that message with the wallet.
- Call
verifyExternalWallet({ externalWallet, signedMessage })to finish.