useAuth

Manage user authentication with functions such as connect, logout, and retrieve access token.

Connect Users

Use the connect() function to handle user sign-ups and sign-ins. When a user signs up, a wallet is created for them behind the scenes and becomes immediately available upon completion of the sign-up process. To modify the login options, simply visit the tweed.

chevron-rightconnect ()hashtag
import { useAuth } from "@paytweed/core-react";

const { connect } = useAuth()

Returns

This method returns a Promise that resolves with a string representing oAuth access token

Logout users

To logout users from the application, call the logout function.

chevron-rightlogout ()hashtag
import { useAuth } from "@paytweed/core-react";

const { logout } = useAuth()

Get user access token

Get the user access token (JWTarrow-up-right)

chevron-rightaccessTokenhashtag
import { useAuth } from "@paytweed/core-react";

const { accessToken } = useAuth()

Returns

This method returns a string represent the user JWTarrow-up-right

Verify if the user is logged in

chevron-rightisAuthenticatedhashtag

Returns

This method returns true if the user is authenticated and false if they are not.

Last updated