useCheckAuth
useCheckAuth will validate a given e-mail and a login code with the server, in order to establish an authenticated session for a user.
This hook should be called at the top most level in your application. For web applications, the hook expects to receive the login_code and email query parameter that is encoded in the login link that the user clicks.
useCheckAuth is effective only once in your application's lifecycle, and that is in your first page load. The user clicking on the login link and opening your app in a new session would generally be this page load.
If it detects the page load is not originated from a login link, it has no effect.
1
import qs from "query-string"; // https://www.npmjs.com/package/query-string
2
3
function App() {
4
const params = qs.parse(window.location.search);
5
6
useCheckAuth({
7
email: params.email
8
loginCode: params.login_code
9
});
10
11
return (
12
<InnerApp />
13
);
14
}
Copied!

Parameters

email

The email parameter in the login link.

loginCode

The login_code parameter in the login link.
Copy link
Contents
Parameters