Microservice responsible for authenticating jwts and for the creation of new users.
Need to add a .env file in this directory or set in you system environment variables if being done locally.
It should include:
`
- AF_SECRET=[INSERT YOUR OWN SECRET HERE]
- AF_EMAIL_SECRET=[PASSWORD FOR THE EMAIL TO BE USED]
- AssignForceAuth=[DATABASE URL HERE]
- AssignForceSalt=[YOUR KEY WORD HERE FOR PASSWORD HASHING] `
uri: /register
Expected body:
{
"email": "email",
"role": "admin | trainer"
}This route creates a new user in the database with the status of "pending" from the request body. Returns a JSON with a user in the format of:
{
"userId": id,
"email": "email",
"password": null,
"status": "status",
"role": "role"
}uri: /resolve
This route will retrive all users with the status of "pending". Returns a JSON with a set of users in the format of:
{
"userId": id,
"email": "email",
"password": null,
"status": "status",
"role": "role"
}uri: /resolve/{userId}
Expected body:
{
"userId":id,
"email":"email",
"status":"status",
"role": "role"
}This route will change the user's status accordingly. Returns a user JSON in the format of:
{
"userId": id,
"email": "email",
"password": "hashed password",
"status": "status",
"role": "role"
}uri: /password
Expected body:
{
"userId": id,
"email": "email",
"password": "password that they wish to set",
}This route will set set the user's password. Returns a user JSON in the format of:
{
"userId": id,
"email": "email",
"password": "hashed password",
"status": "status",
"role": "role"
}uri: /login
Expected body:
{
"email":"email",
"password":"password"
}This route will return a JWT if the email and password are correct. Returns a JWT in the form of a string.
uri: /verify
A JWT string is expected in the body.
This is simply to verify if the provied JWT is valid. Returns a user JSON in the format of:
{
"id": id,
"email": "email",
"role": "role"
}