useLogin
useLogin is used to initiate a user authentication via their e-mail address.

Basic Usage

1
function Component() {
2
const [login] = useLogin({
3
onAuthRequestSuccess: () => {
4
// do something on success like notifying the user
5
// to check their e-mail
6
},
7
onAuthRequestFailure: (error) => {
8
// do something with the error
9
}
10
});
11
12
return (
13
<button onClick={() => login("[email protected]")}>
14
Click here to login
15
</button>
16
);
17
}
Copied!

Parameters

onAuthRequestSuccess is called when the e-mail was successfully sent from the server with the auth request.
onAuthRequestFailure is called with an Error object when the auth request fails for some reason. More information on the exact error can be found by inspecting the error.message.
Copy link
Contents
Basic Usage