Go to file
Franklin 8f251aa80e Fixed err lib 2023-10-27 20:42:34 -04:00
.idea Error refactor 2023-09-24 12:42:11 -04:00
migrations Auth with user token 2023-09-21 13:13:10 -04:00
sql/schema Committ 2023-09-20 16:23:29 -04:00
src Fixed err lib 2023-10-27 20:42:34 -04:00
.gitignore Committ 2023-09-20 16:23:29 -04:00
Cargo.lock Tweaked user file for warning and set err to path 2023-10-03 08:01:21 -04:00
Cargo.toml Tweaked user file for warning and set err to path 2023-10-03 08:01:21 -04:00
Readme.md Readme info 2023-09-21 13:22:39 -04:00

Readme.md

User-lib

by Franklin Blanco

This library is my attempt at developing a recyclable utility for different projects, and not having to setup an authentication microservice each time I start a new project.

Must use Postgres!

How to use?

Setup:

  • Add this library to your Cargo.toml
  • Copy the migrations from the migrations folder inside this library into your migrations
  • Run the migrations Usage:
  • A user can have many credentials (Currently only 3, one for each CredentialType: Username, Email, PhoneNumber)
  • Register a user with register_user().await This function returns a Token that holds an Auth token that's usable for 7 days and a Refresh token in case the auth expires.
  • Authenticate a user with their id and auth_token using authenticate_user().await
  • If that's expired use refresh_token().await
  • If you want another token then use password_login().await
  • reset_password().await To reset password with current password
  • force_reset_password().await To reset password without knowing the password (YOU MUST IMPLEMENT YOUR OWN WAY OF VALIDATING THAT USER'S IDENTITY)