Skip to main content

Two Factor Auth - Disable

Endpoint​

/i/two-factor-auth?method=disable

Overview​

Disables 2FA for the authenticated user.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

Requires authenticated user context.

Request Parameters​

ParameterTypeRequiredDescription
methodStringYesMust be disable.
api_keyStringYes (or use auth_token)API key for authentication.
auth_tokenStringNoAuth token as query parameter or countly-token header.

Examples​

Disable 2FA for current user​

/i/two-factor-auth?api_key=YOUR_API_KEY&method=disable

Response​

Success Response​

{
"result": "Disabled 2FA for user"
}

Response Fields​

FieldTypeDescription
resultStringResult message.

Error Responses​

  • 403
{
"result": "Can not disable 2FA for user when it is globally enabled"
}
  • 500
{
"result": "Database error while disabling 2FA"
}

Behavior​

  • Clears two_factor_auth.secret_token and sets two_factor_auth.enabled=false.
  • Emits system log action: two_factor_auth_disabled.
Implementation details

Configuration Impact

SettingDefaultAffectsUser-visible impact
two-factor-auth.globally_enabledfalseDisable flowWhen true, user self-disable is blocked with 403.

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersUser account settingsDisables user 2FA and removes stored secret.
countly.systemlogsAudit trailReceives two_factor_auth_disabled action.