This guide will show you how to implement the user authentication in a PHP application. For this tutorial, we will use the PHP demo from GitHub and show you step by step how to run it.
This tutorial assumes you have:
- Basic knowledge of HTML/CSS
- PHP 6 or later
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 PHP demo using terminal
This is the file structure you will get in the PHP 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.
ajax_handler - Contains server side code and routing API to be used in demo
src folder - contains the required LoginRadius SDK functions to work with demo
. +-- demo | +-- ajax_handler/ | +-- assets/ | --- index.html | --- profile.html | --- resetpassword.html -- src/LoginRadiusSDK/ --- composer.json
- Set your LoginRadius credentials on the client and server side in the following files
<?php define('LR_API_KEY', 'LoginRadius API Key'); define('LR_API_SECRET', 'LoginRadius API Secret'); // Pass API Secret Key
commonOptions.apiKey = "<LoginRadius API Key>"; commonOptions.appName = "<App Name>";
Upload the complete folder in your server wrapped in directory
Now run your application in your web browser http://localhost:3000/demo
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