Figma desing url figma crendentails kansagrasavan111@gmail.com sa123van
Features
- It will save the useremail and phone number to postgresql database.
- generate random otp and save to storage for limited time.
- send otp to email using smtp.google.com server.
- send otp to mobile using twillo apis.
- do more research into mobile send otp for optimization of cost.
Request type
request type: POST
path: api/register
request payload: {
"useremail": "kansagra@gmail.com",
"telephoneNumber": "+919316370069"
}
response : {
"message": "otp was send to email and phone. please enter otp."
}
Logic :
- enter email and phone number into user table of database. here we used postgres as database.
- if table already contain the entry then it will return message "fail to save user."
Features
- Authentication of OTP.
- create two Roles as "USER" and "OWNER" and assign them access.
- Not Working, need to do more research. - create authentication of the user roles and roles based access of APIs.
Request type
request type: POST
path: api/authentication/useremail
request payload: {
"useremail": "kansagra@gmail.com"
"otp": "636578" // 6 digit otp message
}
success response : {
"message": "Authentication successfull"
}
failed response : { //if email is wrong
"message" : "enter valid email address."
}
failed response : { //if OTP is wrong or expired.
"message" : "OTP is expired or it is wrong."
}
-----------------
request type: POST
path: api/authentication/userTelephoneNumber
request payload: {
"telephoneNumber": "+919316370069",
"otp": "636578" // 6 digit otp message
}
success response : {
"message": "Authentication successfull"
}
failed response : { //if mobile number is wrong
"message" : "enter valid mobile address."
}
failed response : { //if OTP is wrong or expired.
"message" : "OTP is expired or it is wrong."
}
------------------
request type: POST
path: api/role/setRole
request payload: {
"telephoneNumber": "+919316370069",
"Role": "USER" Or "OWNER"
}
success response : {
"message": "USER OR OWNER role is successfully."
}
failed response : { //if mobile number is wrong
"message" : "Setting role is unsuccessfull."
}
Logic :
- enter otp code with the email address or phone number.
- If Authentication with Otp is successfull then create JWT token with all neccesary user claims and send to client.
- It also assign the Role "USER" or "OWNER" with user_role table.
Features
- create POST request of truck details. with OWNER role.
- creating flag of verification pending.
- verify document by admin user. and make flags true.
** Spring Security with Jwt token Authentication **
https://github.com/murraco/spring-boot-jwt