useAuth() hook provides access to essential authentication methods and user session data from FutureverseAuthProvider. It exposes the following methods and variables:
Example:
useAuth methods
signIn()
This method is used for signing in when not using the auth-ui library, ideal for building custom authentication flows. It accepts two parameters:
{SignInOptions}: A Sign-in options object. The object can include the required type of authentication method, and the optionals the signer, and the account address.flow: It is an optional parameter that determines the sign-in flow, which can beredirectorpopup. It defaults toredirect.
signOutPass()
Method for sign-out. It can accept an object as parameter with the following attributes:
onBeforeRedirect: Function to be executed before redirecting the user to logout page. Default is undefined.flow: This parameter determines the sign-in flow, Silent or Redirect. It defaults toredirect.disableConsent: Boolean to skip the logout consent page. Default is set totrue.postRedirecturi: URL to redirect the user after logout, it must be pre-registered in the client configuration. Default is undefined.
authClient
Initialisation of FutureverseAuthClient.
Example:
userSession
An object containing the user session data:
- EOA (Externally Owned Account)
- Chain ID
- Custodian
- FuturePass
- Linked Address (an array)
- User (OICD or
null)
More information about the acronyms mentioned above can be found in the Glossary section.
authMethod
Method that returns the type of authentication method used:
- EOA
- X (former Twitter)
- TikTok

isFetchingSession
A boolean that indicates whether the session data is still being fetched (true if loading, false once complete). Use it to manage loading states in your UI.