Skip to content

React-Native Code Sample

Before integrating a React-Native Web3 app with the Arcana Auth SDK, address the pre-requisites first. Then install the auth-react-native package and integrate the SDK.


Configure Social Login
Configure Social Login
  • By default, a Testnet configuration profile is created after the app is registered. A unique Client ID is assigned to the React-Native app. Note this value, it will be required later during app integration.
Get ArcanaClient ID
Get Arcana Client ID

Install SDK

Install the latest version of the auth-react-native package.

npm i @arcana/auth-react-native
(cd ios && pod install)


For a complete React-Native integration example, see Auth Examples GitHub Repository.

Integrate App

Refer to the React-Native sample code in the repository mentioned earlier. In the App.js file, the Auth component is imported and initialized using the Client ID assigned to the React-Native app during app registration.

import React, { useState } from "react";
import { Text, Button, View } from "react-native";
import Auth from "@arcana/auth-react-native";


  return (
        <Button title="Hide" onPress={hide} />
        <Button title="Login with google" onPress={login} />
        <Button title="Login with google" onPress={login} />
        <Button title="Get balance" onPress={getBalance} />
        <Button title="Send transaction" onPress={sendTx} />

        <Button title="Get User Info" onPress={getUser} />
        <Button title="Get Account" onPress={getAccount} />
        <Button title="Show wallet" onPress={show} />
        <Button title="Logout" onPress={logout} />

Onboard Users

Next, add code to onboard users. In this example, we use the custom login UI option and use loginWithSocial method of the Auth to onboard users via 'Google' as the social login provider.

  const login = async () => {

Once a user authenticates, the built-in Arcana wallet is displayed in the app's context and can be used for signing blockchain transactions. See Arcana wallet User Guide for more Web3 wallet operation details.

Login and access in-app Arcana Wallet
Login and access in-app Arcana Wallet

Use Web3 Wallet Operations

Developers can add code as required to programmatically call Web3 wallet operations for authenticated users. See Arcana wallet Developer's Guide and the Arcana Developer Dashboard User Guide for details on wallet configuration.

That's all!

The React-Native app is successfully integrated and ready to onboard Web3 users via social login, email using the configured providers. Authenticated users can instantly access the Arcana wallet to sign blockchain transactions.

See Also

Last update: April 12, 2024 by DocX, shaloo, shaloo