You can verification face with passive liveness by ASLIRI.
The SDK support for ReactJS / NextJS
- wasm folder provided by ASLIRI
- copy to projectname/public/copyhere...
npm i asliri-passive-liveness-react
import { CheckAuthentication, PassiveLiveness } from "asliri-passive-liveness-react"
import { useCallback, useEffect, useState } from "react";
function App() {
const result = (data:any) => {
console.log(data.message); // message response
console.log(data.result); // result liveness
console.log(data.image); // image base64
};
const [auth, setAuth]:any = useState("");
const [apiCalled, setApiCalled] = useState(false);
const getAuth = async () => {
const getAuthenticationResult = await CheckAuthentication("provided by ASLIRI");
setAuth(getAuthenticationResult);
console.log({ getAuthenticationResult });
};
useEffect(() => {
setApiCalled(true);
}, []);
useEffect(() => {
if (apiCalled) {
getAuth();
}
}, [apiCalled]);
const handleError = useCallback((error: Error) => {
alert(error);
}, []);
return (
<>
<PassiveLiveness getAuthentication={auth} getResult={result} onError={handleError} />
</>
)
}
export default App
Thank you.