2FA API

Two Factor Authentication is an extra layer of security used when logging into an online account. Its main goal is to prevent someone, who knows your login credentials to log in to your account without your permission.

I developed a Two Factor Authentication via SMS API, which can be used with any phone, as it is using only SMS communication to send you the PassKey. The PassKey consists of 6 lower or uppercase characters or numbers. The PassKey is sent to the user’s phone as SMS text and is valid for 30 seconds after the request for authentication was made. The request can be made directly to the website by using the POST method for transferring the data or via a 2FA_API.dll class library used for .NET Framework 4.5 and above projects for windows computers. Before your clients can use this 2FA they need to register in the form below so API knows who to send the PassKey.

Using the 2FA API

There are two methods of using my Two Factor Authentication API. The first method is universal and can be accessed from any advanced programming language, that is by sending HTTP requests via the POST method to my API, as you can see on the code below.

//This is the example of making a HTTP request via the POST method in C# using .NET Framework 4.5.

//Connecting to php part of 2FA_API.
var request = (HttpWebRequest)WebRequest.Create("http://leepush.eu/2fa_api.php");

//Transmitting the data to php part of 2FA_API.
var postData = "email=" + Uri.EscapeDataString(email);
var data = Encoding.ASCII.GetBytes(postData);

request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;

request.GetRequestStream().Write(data, 0, data.Length);

//Receiving the data from php part of 2FA_API.
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

The second method is suitable only for Windows applications as it is using .NET Framework 4.5. The class library (2FA_API.dll) can be downloaded here, which has to be imported into the project and can be used with ease by calling easy to understand functions. I also provided a demo project that can help you with the implementation of the 2FA_API.dll class library into your project. The demo project can be downloaded here.


Leave a Reply

Your email address will not be published.