Two Factor Authentication Usage & Sending OTP SMS Using Twilio
Here're some of the project's best features:
- Two Factor Authentication (2FA)
- One Time Password (OTP)
- Sending SMS
1. 1
- Note: You can also work with another SMS provider, I chose Twilio in this project.
- Register from this address first -> www.twilio.com
- Enter the API information you got from Twilio into application.yml
twilio:
account_sid: #your account sid
auth_token: #your auth token
trial_number: # your trial number
1. 2
- Run the application
- To register first, Make a POST request at "/user/register" like a
{
"username" : "burak",
"password" : "123456",
"telephoneNumber": "+905555555555"
}
{
"username" : "burak",
"password" : "123456"
}
- If the credentials are
correct
, an OTP code will be sent to the phone number registered via SMS.
- To OTP login, Make a POST request at "/user/secret" like a
{
"username" : "burak",
"code" : "148253"
}
- If the code is
correct
, it will return the message"Welcome to the hidden page"
. - That's it.
Technologies used in the project:
- Java
- Springboot
- H2 Database
- Two Factor Authentication
- One Time Password