Overview
Intro
Setting up a login and sign-up system can sometimes be a very unpleasant experience, especially for new devs. For pro devs, the challenge is "the standard". For this, Leaf has prepared something really simple.
Leaf Leaf Auth allows you to set-up authentication in just one line of code๐ ๐ . Literally 1 line๐. To use Leaf Auth, you simply need to initialise the Leaf Auth package.
Authentication methods:
basicLogin()
Basic login is used to create a user login. It takes in a username and a password, it checks for the provided username and password in the users
table of your database, so, for basicLogin to work, you need a users
table. Also, the key for the data you pass in should
be username
and password
. It returns the user data and a generated JSON Web Token.
If this data comes from a form, be sure to make the name
options username
and password
basicRegister()
Basic register is used to create a user register. It takes in a username, email, password and a password confirmation,
it inserts the provided data into the users
table of your database, so, for basicRegister to work, you need a users
table.
After this, you can call the basicLogin method to get a token for the user
If this data comes from a form, be sure to make the name
options username
, email
, password
and confirm_password
Next Steps
SessionSimple Routing
Request
Response