API Multi-Factor Authentication
Introduction
Overview
In this document, we will guide you through the Sectrify Multi-Factor Authentication mechanism, as implemented in Sectrify API for administrative needs.
Sectrify’s Multi-Factor Authentication uses Time-based One-Time Passwords (TOTP) and was tested with the Google Authenticator app.
Sectrify’s Multi-Factor Authentication consists of the following steps:
Prerequisites
Before you start, you will need to:
- register at https://console.sectrify.com and set your username and password
- create new organization (customer)
- get familiar with API Quickstart
- install Google Authenticator (or alternative) on your phone from:
Conventions
In this document, we follow conventions and use variables as defined in API Quick start.
TOTP initial configuration
To configure TOTP multi-factor authentication for a user, you need to follow the following process:
- Log in as the user
- Generate TOTP keys using
POST /users/{username}/otpendpoint - Add Sectrify to your Google Authenticator by scanning generated QR code
- Activate multi-factor authentication by providing user-supplied verification code to
PATCH /users/{username}/otpendpoint
Initial configuration example
Generate TOTP keys
Request:
Response:
Display QR code to the user
Activate MFA using verification code
Request:
Response: HTTP status 204.
Using multi-factor authentication
To correctly support multi-factor authentication, your app needs to detect HTTP status code 424. Once such a code is received, the app should resend the failed request with an additional HTTP Header, X-OTP, containing TOTP code
generated by the TOTP app (Google Authenticator).
Login without one-time password
Request:
Response (with headers):
As you see, we got HTTP status 424. A request needs to be repeated with X-OTP header included.
Login with one-time password
Request:
Response: