1.0.9 • Published 1 month ago
uae-frontend-auth2 v1.0.9
✨ URL, Enquiry, Device, Visit and IP verification
Makes use of the following APIs:
- /user/device for device uuid creation
- /user/visit for visit creation
- /user/ip for session verification and ip data retrieval
- /user/enquiry for enquiry data retrieval
🚀 Installation
$ npm install uae-frontend-auth
🔧 Usage
import { AuthProvider } from 'uae-frontend-auth';
const App = () => {
return (
<AuthProvider>
<BeforeAnyApplicationLogic/>
</AuthProvider>
);
};
For accessing the deviceUuid
, visitId
, ip data, countryProductId
and enquiry data, you can use the following hook:
import { useAuth } from 'uae-frontend-auth';
const {
enquiryId, // string, enquiry id; null if not available or loading is true
countryProductId, // number, country product id; null if not available or loading is true
deviceUuid, // string, device uuid; null if not available or loading is true
visitId, // number, visit id; null if not available or loading is true
IPData, // object containing ip data; empty object if not available or loading is true
loading, // boolean, true if authentication is in progress
} = useAuth();
deviceUuid
, visitId
, countryProductId
and sourceId
are also stored in the local storage. You can access them directly from the local storage as well.
visitId
key in the local storage is
"visitId_${countryProductId}"
Others are stored as it is.