Swedish site
SMS API service icon

Two-factor authentication via SMS from iP.1

Two-factor authentication (2FA) not only gives your customers' accounts a higher degree of security - you also protect your own system against junk accounts and malicious robot logins.

Free trial account

Create an account, copy the sample code and paste it into your project, then you are ready to increase the security of your system!

SMS Integration services from iP.1

What is Two-Factor Authentication?

Two-factor authentication (2FA) means an extra security step to ensure that it is really the right person trying to log in.

The most common approach is to use 2FA linked to the regular login process, which is triggered when a user has entered their password. The system in question then sends out a verification code via SMS to the user's registered mobile number, which the user then fills in to confirm their login.

Why should I use two-factor authentication?

Using only usernames and passwords to secure your online accounts is no longer an optimal security solution due to the recurring problem of data breaches that are carried out to steal important information, such as credit card information, social security numbers and other sensitive data.

When 2FA is used in connection with login, it becomes much more difficult for unauthorized persons to access devices and digital services than when only one factor, such as a password, is used. Protect your systems or your customers' accounts by integrating 2-factor authentication (2FA) through iP.1´'s smart SMS API.

Global blacklist for Spam numbers

When you integrate two-factor authentication from iP.1, you automatically get access to our global blacklist which consists of virtual numbers, as well as mobile numbers used in, among other things, account registrations of bots and other forms of malicious activity. You can read more about how to determine if a number is a so-called one-time number at our Github Page .

The blacklist is excellent to use to check numbers that are entered during, for example, account registration in a registration process. You also have the option of adding numbers to the blacklist yourself to ensure that these numbers are not used in other systems. You can read more about adding numbers to the blacklist on our Github page .

As simple as that!

Create a free development account, paste the code from our code examples and start using 2FA!

With the help of our detailed documentation page, you can easily create an 2FA flow in your own system or software in no time..

Do you need support?

No problem! Our development team is ready to guide you in your integration, just give us a call or send us an e-mail and we will help you

Authenticate Validate
using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://api.ip1sms.com/api/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "API Key"); var authenticate = new { Recipients = "46712345678", From = "iP1", MessageFormat = "Use the following code for authentication {0}" Length = "6" ExpirationTime = "1200" }; HttpResponseMessage response = await client.PostAsJsonAsync("authentications", authenticate); }
string submittedCode = Console.ReadLine(); // e. g. 453342 using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://api.ip1sms.com/api/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "API Key"); var validate = new { Phone = "46712345678", Code = submittedCode, }; HttpResponseMessage response = await client.PostAsJsonAsync("authentications/validate", validate); if (response.IsSuccessStatusCode) { Console.Log("Validated"); } else { Console.Log("Failed, " + response.StatusCode + ": " + await response.Content.ReadAsStringAsync()); } }
Authenticate Validate
$message = array( 'Phone' => '46712345678', 'From' => 'iP1', 'MessageFormat' => 'Use the following code for authentcation {0}', 'Length' => '6', 'ExpirationTime' => '1200' ); $jsonEncodedMessage = json_encode($message); $options = array( 'http' => array( 'header' => array( 'Content-Type: application/json', 'Authorization: Bearer ' . 'API key', 'Content-Length: ' . strlen($jsonEncodedMessage) ), 'method' => 'POST', 'content' => $jsonEncodedMessage, ) ); $context = stream_context_create($options); $response = file_get_contents('https://api.ip1sms.com/api/authentications/validate', false, $context);
$submittedCode = $_POST["code"]; // e. g. 453342 $conf = array( 'Phone' => '46712345678', 'Code' => $submittedCode, ); $jsonEncodedMessage = json_encode($conf); $options = array( 'http' => array( 'header' => array( 'Content-Type: application/json', 'Authorization: Bearer ' . 'API key', 'Content-Length: ' . strlen($jsonEncodedMessage) ), 'method' => 'POST', 'content' => $jsonEncodedMessage, ) ); $context = stream_context_create($options); $response = file_get_contents('https://api.ip1sms.com/api/authentications', false, $context); echo $response;