two-factor-auth-config-controller
Generate 2FA account config (generateTwoFaAccountConfig)
Generate new 2FA account config template for specified provider type.
For TOTP, this will return a corresponding account config template with a generated OTP auth URL (with new random secret key for each API call) that can be then converted to a QR code to scan with an authenticator app. Example:
{
"providerType": "TOTP",
"useByDefault": false,
"authUrl": "otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=PNJDNWJVAK4ZTUYT7RFGPQLXA7XGU7PX"
}
For EMAIL, the generated config will contain email from user's account:
{
"providerType": "EMAIL",
"useByDefault": false,
"email": "tenant@thingsboard.org"
}
For SMS 2FA this method will just return a config with empty/default values as there is nothing to generate/preset:
{
"providerType": "SMS",
"useByDefault": false,
"phoneNumber": null
}
Will throw an error (Bad Request) if the provider is not configured for usage.
Available for any authorized user.
post/api/2fa/account/config/generate
Request
- Base URLhttps://demo.thingsboard.io
- Authnone declared
- TypeScripthttps://skmtc.dev/thingsboard/apis/thingsboard-rest-api/docs/api/2fa/account/config/generate/post.tsA function with typed inputs. Its response is checked against the schema.
Query parameters
providerTypestring required
2FA provider type to generate new account config for
Response
OK
Changes
No recorded changes to this operation across all 2 revisions of this API.