Just Auth Docs
  • JustAuth
  • Getting Started with JustAuth
  • Integration
    • Initialization
    • Using the useJustAuth Hook
    • Opening the Auth Modal
    • Checking Authentication Status
    • Exporting Private Key
    • Logging Out
    • Signing Messages
    • Signing Transactions
Powered by GitBook
On this page
  • Overview
  • How to Use
  • Returned Values
  1. Integration

Using the useJustAuth Hook

Overview

The useJustAuth hook provides access to all authentication-related functionality in your component.

How to Use

  1. Import the hook:

    import { useJustAuth } from 'just-tron-auth';
  2. Destructure the necessary values and functions:

    const {
       isAuthenticated,
       userEmail,
       userAddress,
       openAuthModal,
       logout,
       signMessage,
       signTransaction,
       exportPrivateKey
    } = useJustAuth();

Returned Values

  • isAuthenticated (boolean): Indicates if the user is logged in.

  • userEmail (string): The email of the authenticated user.

  • userAddress (string): The address of the authenticated user.

  • openAuthModal (function): Function to open the authentication modal.

  • logout (function): Function to log out the user.

  • signMessage (function): Function to sign a message.

  • signTransaction (function): Function to sign a Tron transaction.

  • exportPrivateKey (function): Function to export the user’s private key.

PreviousInitializationNextOpening the Auth Modal

Last updated 8 months ago