Skip to content

Near App: Onboard Users

Estimated time to read: 4 minutes

In this guide, you will learn how 'Vanilla HTML/CSS/JS' Web3 apps can integrate with the Arcana Auth SDK onboard users and allow authenticated users to perform Near blockchain transactions using the Arcana wallet.

Developers can choose to onboard users by either using the built-in plug-and-play login UI provided by the Arcana Auth SDK or build a custom login UI. Once a user onboards the app, they can instantly access the Arcana wallet within the app context. Developers must choose and configure Near chain through the Arcana Developer Dashboard prior to integrating the app with the Arcana Auth SDK.

Prerequisites

  • Make sure you can access the Arcana Developer Dashboard: https://dashboard.arcana.network

  • Use the Arcana Developer Dashboard to register and configure the app. The plug-and-play pop-up UI screen will display only those authentication providers that are configured using the Arcana Developer Dashboard. If no authentication providers are configured in the Arcana Developer Dashboard, then users can only onboard the app via the passwordless login option. See how to configure authentication providers for details.

  • Follow the instructions as per the app type and integrate the app with the Arcana Auth SDK before accessing user onboarding functions of the Arcana Auth SDK.

  • Make sure you configure the required Near chains through the dashboard. See how to set up Near blockchain transactions through the Arcana wallet in apps that are integrated with the Arcana Auth SDK.

Non-EVM Chains

When registering an app through Arcana Developer Dashboard, the choice of chain type (EVM, Solana, MultiversX, Near) is final. App developers can't change it later. They can switch the default chain within the same type. For example, a Solana app on Testnet can switch to Solana Mainnet or Solana Dev but not to MultiversX or an EVM chain.

Steps

Onboarding users and enabling Near blockchain transactions through the Arcana wallet is simple!

Just a single line of code!

Option 1: Onboarding via plug-and-Play Login UI

After successfully integrating the app with the Arcana Auth SDK, make sure the AuthProvider is successfully initialized. Then simply add a single line of code, call to the connect function of the Arcana Auth SDK and enable the built-in plug-and-play login UI in the app when a user clicks a button to log in:

await auth.connect();

The connect() function will bring up the plug-and-play pop-up modal in the app context and display the available options for user onboarding. Only those options are displayed that were earlier configured by the developer using the Arcana Developer Dashboard.

The figure below shows the plug-and-play login UI screen for a test app. All the authentication providers configured by the developer are available as the onboarding options. The passwordless login option is enabled by default.

Plug-and-Play Login UI
Plug-and-Play Login UI

Arcana JWT Token

Upon successful authentication, Arcana Auth SDK returns a unique JWT token to the app called the Arcana JWT Token. App developers can access this token via getUser() method and refer to the loginToken field of the UserInfo object.

Developers can use this token to verify the user and subsequently generate another token for app use if required.

In the future, the Arcana JWT Token will be deprecated. Use userDIDToken to verify user.

Upon successful authentication, Arcana Auth SDK returns a unique DID token to the app called the Arcana DID Token. App developers can access this token via getUser() method and refer to the userDIDToken field of the UserInfo object.

Developers can use this token to verify the user and subsequently generate another token for app use.

No plug-and-play support for Firebase authentication.

The plug and play feature of the Arcana Auth product is not supported for Firebase. Developers must build a custom login UI and add code to onboard users. For details, see onboarding users via Firebase and custom login UI

That is all!

When a user logs into the app that is registered and configured for using Near, a non-EVM chain, they can instantly perform Near blockchain operations through the Arcana wallet.

Option 2: Onboarding via custom Login UI

Alternatively, developers can use custom login UI to onboard users via one of the supported social login mechanisms.

That is all!

No plug-and-play support for Firebase authentication.

The plug and play feature of the Arcana Auth product is not supported for Firebase. Developers must build a custom login UI and add code to onboard users. For details, see onboarding users via Firebase and custom login UI

What's Next?

After onboarding users in the app, developers can use other Arcana Auth SDK functions and add supported Web3 wallet operations for the Near blockchain. See Arcana Auth SDK Usage Guide, how to enable the Arcana wallet for details.

See also


Last update: June 12, 2024 by shaloo