This guide will show you how to implement the user authentication in a Java application. For this tutorial, we will use the Java demo from GitHub and show you step by step how to run it.
This tutorial assumes you have:
- Basic knowledge of HTML/CSS
- java installed on your system
Get your credentials and whitelist your application domain as explained in this section. This is a mandatory step to successfully implement and run the demo.
You can clone the Auth Page demo repository on your system using below commands:
git clone email@example.com:LoginRadius/login-page-demos.git
git clone https://github.com/LoginRadius/login-page-demos.git
Now move to the directory Java demo by running the following command using the terminal
and Open/import java-idx-demo in your java IDE (Eclipse).
This is the file structure you will get in the Java demo, let's see what each file does
demo folder - Contains all the HTML, CSS and JS file to create UI for the test application.
static folder - Contains all the CSS and JS file to create UI for the test application.
java folder - Contains server side code and routing API to be used in demo
templates folder - contains the HTML template for Login and profile page
. .project pom.xml README.md src | -- main | -- |--- |java/ | -- |--- |resources/ | -- |--- |-- application.properties | -- |--- |-- static | -- |--- |-- templates | -- |--- |-- --- index.html | -- |--- |-- --- profile.html
- You need to add your LoginRadius credentials in the demo app to communicate with LoginRadius SDK
- Server side:
server.port= 8080 app.apikey=xxxxxxxxxx //Add api key app.apisecret=xxxxxxxxx //Add api secret
- Client side:
commonOptions.apiKey = "<LoginRadius API Key>"; //Add api key commonOptions.appName = "<App Name>"; //Add app name
- Running application
Run this application on your java IDE and after successful build
Then visit http://localhost:3000/demo from your local browser and you will see the application running. Once you click on login button it will redirect you to auth page.
- Login with Auth Page (IDX)
- Registration with Auth Page (IDX)
- Email Verification
- Forgot Password
- Reset Password