burakfircasiguzel / SpringBoot-2FA-OTP-SMS-Twilio-H2Database

Two Factor Authentication Usage & Sending OTP SMS using Twilio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Springboot 2FA OTP SMS with Twilio

SpringBoot-2FA-OTP-SMS-Twilio-H2Database

Two Factor Authentication Usage & Sending OTP SMS Using Twilio

๐Ÿง Features

Here're some of the project's best features:

  • Two Factor Authentication (2FA)
  • One Time Password (OTP)
  • Sending SMS

๐Ÿ› ๏ธ Installation Steps:


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

๐ŸŽˆ Usage Steps:

1 - Register

  • To register first, Make a POST request at "/user/register" like a
{
    "username" : "burak",
    "password" : "123456",
    "telephoneNumber": "+905555555555"   
}



2 - Normal Login

- To normal login, Make a POST request at "/user" like a
{
    "username" : "burak",
    "password" : "123456"
}
  • If the credentials are correct , an OTP code will be sent to the phone number registered via SMS.



3 - Login with OTP Code

- Add the code in the incoming SMS to the request
- 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.

๐Ÿ’ป Built with

Technologies used in the project:

  • Java
  • Springboot
  • H2 Database
  • Two Factor Authentication
  • One Time Password

About

Two Factor Authentication Usage & Sending OTP SMS using Twilio


Languages

Language:Java 100.0%