react-logify
v1.0.6
Published
Login with Logify with ReactJs
Downloads
2
Maintainers
Readme
React Logify
Sample Code
Logify.id - Unlimited free authorization & authentication service
Install package
npm install react-logify
Setup env variable
Create .env
file and store Logify Domain Key
REACT_APP_LOGIFY_DOMAINKEY = YOUR_DOMAIN_KEY
Import useLogify
import { useLogify } from 'react-logify';
const { user, onLogin, onLogout } = useLogify();
where type of user
is
{
id: string;
profileId: string;
name: string;
pic: string;
email: string;
timezone: string;
organization?:{
id: string;
name: string;
logo: string;
designation: string;
staffId: string;
internal: boolean;
}
}
To Initiate Login
{
!user.id && <button onClick={onLogin}>Login</button>;
}
To Initiate Logout or Switch Persona
{
user.id && (
<>
<button onClick={onLogout}>Logout</button>
<button onClick={onLogin}>Switch Persona</button>
</>
);
}