Deployed Website - Click Here
Implementing OTPless-auth
This Project uses OTPless-SDK with HTML+CSS+JS Technology.
Official Documentation for desired platform can be found here.
- Add div tag
<!-- Any Container Element should be fine, I am using main here just for semantic purpose -->
<div id="otpless-auth"></div>
- Add script tag
<script type="text/javascript" src="https://otpless.com/auth.js"></script>
- Add the following function in your script
/**
* @param {Object} otplessUser - Received User object from OTPless
* @returns {void}
*/
function otpless(otplessUser) {
console.log(otplessUser)
// Do something with otplessUser
// save it in browser storage or database or send it to server.
// ...
// Add your success callback here, if you want to do something on successful authentication
// ...
}
Note:
OTPless authentication SDK seamlessly combines both sign-in and sign-up functionalities. In cases where the user is already registered, the system generates a new Auth-Token with each sign-in request. This Auth-Token, accompanied by the user object, is then sent as a response. Alternatively, for unregistered users, the system creates a new User Account using publicly available data (such as name and email) from the chosen Auth-Provider (e.g., Gmail or WhatsApp). A new Auth-Token is then generated and sent as a response, along with the user object.
- DO NOT USE HTTP
- OTPless-auth needs secure connection to work. Use HTTPS. Using insecure connection may lead to unexpected behavior. (e.g. Blank Container for the Auth Form)
- Remove
cid
attribute from script tag - Either use some online IDE that provides secure connection(e.g. W3Schools-Spaces)
- or use dummy data for development stage,and add OTPless-auth to your project in pre-production/test stage in a secured environment.
- or simply Containerize your development environment with Nginx+self-signed SSL certificates.