Methods
getSession
This is the most important and used method in this whole authentication system. It's used to get the current session of the user, which is constantly being checked. You can use this method in any component or middleware.
Here is how you can use it.
More about it
This method returns a promise that resolves to an object with 3 properties: success
, message
and data
.
The data
consits of email , role and id of the user.
This method will also be utilized in the middleware file to protect routes, ensuring that only authorized users can access certain parts of the application.