Quickstart
Learn how to authenticate users, create embedded wallets, and send transactions in your React Native app
0. Prerequisites
This guide assumes that you have completed the setup guide.
1. Enable a user to log in via email
To authenticate a user via their email address, use the React Native SDK’s useLoginWithEmail
hook.
Ensure that this hook is mounted in a component that is wrapped by the PrivyProvider.
You can use the returned methods sendCode
and loginWithCode
to authenticate your user per the instructions below.
Send an OTP
Send a one-time passcode (OTP) to the user’s email by passing their email address to the sendCode
method returned from useLoginWithEmail
:
2. Create an embedded wallet for the user
Your app can configure Privy to automatically create wallets for your users as part of their login flow. The embedded wallet will be generated and linked to the user object upon authentication.
Alternatively your app can manually create wallets for users when required.
Privy can provision wallets for your users on both Ethereum and Solana.
3. Send and sign transactions using the embedded wallet
To request signatures and transactions from a wallet, you must first get an EIP1193 providerfor the wallet.
Once you have the embedded wallet’s EIP-1193 provider, you can use the provider’s request
method to send JSON-RPC requests that request signatures and transactions from the wallet!
The request
method accepts an object with the fields:
method
(required): the name of the JSON-RPC method as a string (e.g.personal_sign
oreth_sendTransaction
)params
(optional): an array of arguments for the JSON-RPC method specified bymethod
Learn more about sending transactions with the embedded wallet. Privy enables you to take many actions on the embedded wallet, including sign a message, sign typed data, and sign a transaction.
Congratulations, you have successfully been able to integrate Privy authentication and wallet into your React Native application!
Was this page helpful?