Authentication
The Hexabase SDK supports multiple authentication operations.
Token auth
Token authentication uses the setToken
method of the Hexabase SDK. At this time, communication processing to Hexabase is being performed, so please perform it as an asynchronous process.
await client.setToken('YOUR_TOKEN');
There are several ways to obtain the token string.
Obtain at login
You can get this string with client.tokenHxb
after performing the following login process. This string is stored in localStorage, etc., and used when reloading.
Use Auth0
Hexabase can be linked with Auth0. Hexabase can be linked with Auth0. Please use the obtained token after performing social or SMS authentication.
Use public tokens
Public tokens can be issued on the Hexabase management screen. This token does not have an expiration date, so it can be used for web application development without authentication.
Note that public tokens refer to the issuing user, so please do not use tokens for administrators or other users.
Email address and password authentication
Authentication using email and password is performed as follows: If the authentication process is successful, the token will be set in client.tokenHxb
.
const email = '[email protected]';
const password = 'password';
await client.login({ email, password });
Logout
To log out, proceed as follows:
await client.logout();