Skip to content

devbathaniotpless/otpless-javascript-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

OTPless

Javascript Demo

Steps to add OTPless SDK to your Website

  1. Create an App in OTPless dashboard and copy the APP ID

  2. Add OTPLESS Sign in

    Add the following code to your sign up/ sign in page where you want to embed your sign in functionality.

    <div id="otpless-login-page"></div>
    <script type="text/javascript" src="https://otpless.com/auth.js" data-appid="PASTE_YOUR_APPID_HERE"></script>
    // Replace with your cid
  3. Retrieve User's Information

    Implement the following function to retrive the user data upon successful authentication of the user.

    <script type="text/javascript">
        function otpless(otplessUser) {
            alert(JSON.stringify(otplessUser));
        }
    </script>

Codes of Interest

Received User Data Format

// otpless user Format
{
    "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "timestamp": "YYYY-MM-DD HH:MM:SS",
    "timezone": "+XX:XX",
    "mobile": {
        "name": "User Name",
        "number": "User Mobile Number"
    },
    "email": {
        "name": "User Name ",
        "email": "User Email"
    }
}

Usage

Prerequisites Any Code Editor

  • Clone this repository
  • Open the code in any code editorand run on localhost
  • Switch branches to check out available options to integrate OTPless SDK in your project.

About

A demo to integrate otpless sdk in your Javascript project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 100.0%