Spanish Total.js
English
Documentation For AI agents
Contents

Security and authentication

Components for confirmation codes, one-time passwords, request limits and OAuth 2.0.

.md GitHub
On this page

Components for confirmation codes, one-time passwords, request limits and OAuth 2.0. This page holds the catalogue groups Security, API.

Each entry lists the inputs and outputs of the component, its main settings and the text of its readme. To add a component to a FlowStream, see Download components.

API

component

confirmation-code.html · version 1

Generates confirmation codes and verifies them.
ParameterTypeDescription
count? Number Count of attempts. Default: 3
type? String Type. Default: pin
length? Number Length. Default: 4
expire? String Expiration. Default: 5 minutes
lock? String Lock.
limit? Number
  1. calls per lock.
Default: 1

Inputs: create (Create), verify (Verify).

Outputs: output (Output).

This component can help you with generating confirmation codes. Keep data structure for inputs according to the documentation below.

create input/output

Create input:

  • id {String} identifier (email, phone number, identifier, etc.)
  • param {String} a custom parameter

Create output:

  • success {Boolean} determines if the code is verified or not accroding to its identifier
  • value {String} a pin/code/token
  • param {String} a custom parameter (it sends only if the value is true)
  • error {String} (optional) a simple error identifier, it can contain:
    • locked the identifier is locked by the previous call

verify input/output

Verify input:

  • id {String} identifier (email, phone number, identifier, etc.)
  • value {String} a pin/code/token

Verify output:

  • success {Boolean} determines if the code is verified or not accroding to its identifier
  • slots {Number} free slots/attempts
  • error {String} (optional) a simple error identifier, it can contain:
    • invalid the code is invalid
    • 404 identifier not found

Settings

  • Lock prevents overwriting of the code according to the identifier
component

iplimiter.html · version 1

Limits the number of requests per IP address.
ParameterTypeDescription
count? Number
  1. limit.
Default: 1
timeout? Number Timeout in seconds. Default: 5
path? String Path to the IP address. Default: ip

Inputs: input (Request).

Outputs: output (Allowed), error (Blocked).

This component limits the number of requests per IP address. The component first tries to obtain the IP address from the $.controller. If that doesn't work, it tries to load the IP address from the payload.

component

oauth2.html · version 1

Obtains an OAuth 2.0 access token from another service.
ParameterTypeDescription
urltoken? String Token URL.
urlauthorize? String Authorize URL.
variable? String Assign token to the global variable.
clientid? String Client ID.
clientsecret? String Client secret.
scope? String Scope.
accesstoken? String Access token.

Inputs: none.

Outputs: none.

This component can obtain OAuth 2.0 access token from 3rd party service.

component

totp.html · version 1

Generates TOTP secrets and verifies one-time passwords for two-factor authorization.
ParameterTypeDescription
issuer? String Issuer. Default: Total.js
time? Number Time. Default: 30

Inputs: generate (Generate), verify (Verify).

Outputs: output (Output).

Time-Based One-Time Password Algorithm

This component can generate a secret and verifies the code (generated via Authenticator app) as a one-time password for 2FA authorization.

  • recommended mobile apps: Google Authenticator or Microsoft Authenticator

How does it work?

First, a user must generate a secret viagenerate input in the authenticator app. Then, for verification of the one-time generated password, you need to use the second input verify, which needs user secrets.

generate input/output

Input data:

  • user {String} email or user/account name without special characters

Output data object with:

  • secret {String} a generated secret which you must store for the specific user
  • url {String} an optimized url address for tokenization
  • qrcode {String} a link to the picture with QR code

verify input/outputs

Input data object with:

  • secret {String}

Output data object with:

  • success {Boolean} determines if the password is valid or not
Made in Europe