When a new user signs up for your application, you want to make sure their contact information is accurate. You'd also like some assurance they are in fact a human being! You want to make sure that every new user account in your system is an actual person and not a robot.
There are many layers of security you can put in place to increase the quality of your signups, but one of the best is an account verification via SMS. Before a registration is fully completed, your application sends the user a one-time passcode via SMS. The user then enters the code on your website to complete their registration.
In this tutorial, you'll learn how to implement account verification at the point of registration using Twilio-powered Authy.
This project is build using Java 8 and uses PostgreSQL as database.
-
First clone this repository and
cd
into it.$ git clone [email protected]:TwilioDevEd/account-verification-servlets.git $ cd account-verification-servlets
-
Copy the sample configuration file and edit it to match your configuration.
$ cp .environment .env
You can find your
TWILIO_ACCOUNT_SID
andTWILIO_AUTH_TOKEN
in your Twilio Account Settings. You will also need aTWILIO_NUMBER
, which you may find here. TheAUTHY_API_KEY
can be found here.Run
source .env
to export the environment variables. -
Create the database.
$ createdb account_verification_servlets
-
Execute the migrations.
$ ./gradlew flywayMigrate
-
Make sure the tests succeed.
$ ./gradlew check
-
Start the server.
$ ./gradlew jettyRun
-
Check it out at http://localhost:8080.
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.