Custom UI Abstraxion Authentication

This guide explains how to implement Abstraxion authentication without using the legacy modal UI, giving you complete control over the user experience during the authentication flow.

Overview

Starting with version @burnt-labs/[email protected] and later, you can implement a custom UI for the Abstraxion authentication process. This allows you to:

  • Display your own loading states and branding during authentication

  • Create a seamless authentication experience that matches your app's design

  • Handle the redirect flow programmatically

Key Changes

1. No Legacy Modal UI Import Required

The Abstraxion CSS import is no longer needed when using custom UI authentication:

- import "@burnt-labs/abstraxion/dist/index.css";

2. Direct Login Method

The useAbstraxionAccount hook now provides a login method that handles authentication without showing the legacy modal:

const { data: account, login, logout, isConnecting } = useAbstraxionAccount();

3. Custom Loading States

You can implement your own loading UI while authentication is in progress:

Implementation Example

Here's a complete example showing how to implement custom UI authentication:

Important Changes from Legacy Modal Authentication

1. Remove Abstraxion Component

The <Abstraxion /> component is no longer needed:

2. Updated AbstraxionContext

The AbstraxionContext now includes the login method and handles redirect authentication automatically:

3. Simplified Loading Component

The built-in Loading component has been simplified to show only a spinner, allowing you to implement your own loading UI:

Migration Guide

To migrate from legacy modal to custom UI authentication:

  1. Remove CSS import: Delete the Abstraxion CSS import

  2. Remove legacy modal components: Remove Abstraxion component and useModal hook

  3. Use login method: Replace legacy modal trigger with the login() method

  4. Add custom loading UI: Implement your own loading state

  5. Handle redirects: The redirect handling is automatic with the new implementation

Benefits

  • Better UX control: Full control over the authentication flow UI

  • Consistent branding: Loading states match your app's design

  • Cleaner code: No need to manage legacy modal state

  • Improved performance: Less CSS to load

Demo

A complete working example is available in the xion.js demo app.

Last updated

Was this helpful?