Spring boot OTP based login with Twilio and JWT token
If you found any of my open source projects helpful, Don't forget to give them a star ⭐ and follow. It won't cost you a thing, but it will help inspire me to continue contribute more
- User enter mobile no
- Generate OTP using Twilio
- User enter OTP recevied in mobile number
- Verify OTP and generate JWT if user otp is valid
- User send any request using jwt
-
/api/client/auth/requestOtp/{phoneNo}
-
Response
"message": "Otp sent successfully",
"status": "success",
"otp":"312323"
}
-
/api/client/auth/verifyOtp/
-
Body
{
"otp":"687619",
"phoneNo":"+916361445559"
}
- Response
{
"message": "Otp verified successfully",
"status": "success",
"jwt": "jwt_token_here"
}
- /api/client/auth/hello
- Header
{
"Authorization":"Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIrOTE2MzYxNDA4NTU5IiwiZXhwIjoxNjYxMTE3MDMzLCJpYXQiOjE2NjEwODEwMzN9._dK8aFLrebA_42rAW3oJfuMhFimiWabioadhC6CRWJ4"
}
- Response Hello World