Authentication with FT4 accounts
In this section, we’ll explore how to implement authentication using FT4 accounts.
Authenticating with FT4 accounts is straightforward with the auth
module. Start by importing the auth
library:
import lib.ft4.auth;
Then, add a call to auth.authenticate
within your operations to validate users securely. This function manages authentication, so you don’t need to manually pass the user’s public key to each operation, making the code more secure and straightforward.
To enable authentication, register an auth handler with the following setup in your Rell module:
@extend(ft4_auth.auth_handler)
function () = ft4_auth.add_auth_handler(
flags = []
);
This extension function registers a new authentication handler, enabling it to authenticate globally across all operations that use auth.authenticate
.