This example application demonstrates how to use Authy as the two-factor authentication provider using Servlets.
-
First clone this repository:
$ git clone git@github.com:TwilioDevEd/authy2fa-servlets.git $ cd authy2fa-servlets
-
Create the database.
$ createdb authy2fa
The application uses PostgreSQL as the persistence layer. If you don't have it already, you should install it. The easiest way is by using Postgres.app.
-
Edit the sample configuration file
.env.example
to match your configuration.Once you have edited the
.env.example
file, if you are using a UNIX operating system, just use thesource
command to load the variables into your environment:$ source .env.example
If you are using a different operating system, make sure that all the variables from the
.env.example
file are loaded into your environment. -
Execute the migrations.
$ mvn compile flyway:migrate
-
Run the application.
$ mvn compile jetty:run
-
Check it out at http://localhost:8080
-
To enable Authy OneTouch to use the callback endpoint you exposed, your development server will need to be publicly accessible. We recommend using ngrok to solve this problem.
$ ngrok http 8080