Skip to content

Plug & Play Auth

In earlier beta releases, apps were required to integrate with the Arcana Auth SDK in order to onboard users with a custom login UI. For instance, the custom login UI code was required to call the loginWithSocial('google') method to onboard users via Google. Similarly, the passwordless login option was required to provision an email input field and call loginWithOTPStart and loginWithOTPComplete functions to onboard users.

Now, the latest Arcana Auth SDK offers a 'plug-and-play' feature, with a built-in login UI. Developers can choose to use custom login UI or get started faster with the built-in user onboarding via the 'plug-and-play auth' feature.

Developers can now choose to use the connect method to bring up the built-in login UI, displaying configured onboarding options as setup using the Arcana Developer Dashboard.

After successful authentication, users instantly access the Arcana wallet for blockchain transactions.

Compact Plug & Play UI

When using the built-in plug-and-play login UI, developers can choose to use the standard login modal or a compact one by specifying the compact: true setting in the connectOptions while instantiating the AuthProvider. For details, see AuthProvider constructor parameters.

import { AuthProvider, CHAIN } from '@arcana/auth'

interface ChainConfig {
  chainId: CHAIN
  rpcUrl?: string
}

const auth = new AuthProvider(`${clientId}`, {
  position: 'left',        // default - right
  theme: 'light',          // default - dark
  alwaysVisible: false,    // default - true
  setWindowProvider: true, // default - false
  connectOptions: {
    compact: true // default - false
  },
  chainConfig: {
    chainId: CHAIN.POLYGON_MAINNET,
    rpcUrl: '',
  },
})

await auth.init()

Compact UI login mode

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 use this token to verify user login and subsequently generate another token for app use. Learn more about how to verify the Arcana JWT Token for apps deployed on Testnet and Mainnet.


Last update: February 2, 2024 by shaloo, shalz