useAuth
The 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()
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 beredirect
orpopup
. It defaults toredirect
.
Example:
signOut()
signOut()
Method for sign-out. It can accept one parameter:
Example:
authClient
authClient
Initialisation of FutureverseAuthClient
.
Example:
userSession
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.
Example:
authMethod
authMethod
Method that returns the type of authentication method used:
EOA
Google
Facebook
X (former Twitter)
TikTok
Email
Example:
isFetchingSession
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.
Last updated