This guide will show you how to implement the user authentication in a Python application. For this tutorial, we will use the Python demo from GitHub and show you step by step how to run it.
This tutorial assumes you have:
- python 2.7 and up
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 Python demo by running the following command using the terminal
This is the file structure you will get in the Python demo, let's see what each file does
static folder - Contains all the CSS and JS and images to create UI for the test application.
template folder - Contains the HTML code for profile and Login page.
LoginRadius folder - contains the LoginRadius Python SDK codes needed to run the authentication demo
+demo/ |-- app.py |-- auth.py |-- lr.py |-- +static/ |-- |--css/ |-- |--images/ |-- |--js/ |-- +templates |-- |--index.html |-- |--profile.html |-- |--resetpassword.html |-- +LoginRadius/
- You need to add your LoginRadius credentials in the demo app to communicate with LoginRadius SDK
API_KEY = "<Enter LoginRadius API Key>" API_SECRET = "<Enter LoginRadius API secret"
commonOptions.apiKey = "<LoginRadius API Key"; commonOptions.appName = "<App Name>";
- Running application
Run the below commands in the terminal from the root folder of the application
pip install flask requests pbkdf2 cryptography && cd python-idx-demo/Demo
This command will install all the required dependency to run the python demo and change the directory to Demo folder from where your application will be served.
Once all the dependencies have been installed run the application
Now you can see application running in the http://localhost:5000, 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