Two-factor
TOTP, email codes and backup codes.
Use this endpoint to disable two factor authentication.
Authorization
bearerAuth Session token from the set-auth-token response header (bearer plugin)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/auth/two-factor/disable" \ -H "Content-Type: application/json" \ -d '{ "password": "string" }'{ "status": true}Enable two factor authentication. Pass method 'totp' (default) to set up an authenticator app (returns TOTP URI and backup codes), or 'otp' to enable email/SMS-based codes immediately.
Authorization
bearerAuth Session token from the set-auth-token response header (bearer plugin)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/auth/two-factor/enable" \ -H "Content-Type: application/json" \ -d '{ "password": "string" }'{ "method": "otp", "totpURI": "string", "backupCodes": [ "string" ]}Generate new backup codes for two-factor authentication
Authorization
bearerAuth Session token from the set-auth-token response header (bearer plugin)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/auth/two-factor/generate-backup-codes" \ -H "Content-Type: application/json" \ -d '{ "password": "string" }'{ "status": true, "backupCodes": [ "string" ]}Use this endpoint to get the TOTP URI
Authorization
bearerAuth Session token from the set-auth-token response header (bearer plugin)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/auth/two-factor/get-totp-uri" \ -H "Content-Type: application/json" \ -d '{ "password": "string" }'{ "totpURI": "string"}Send two factor OTP to the user
Authorization
bearerAuth Session token from the set-auth-token response header (bearer plugin)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/auth/two-factor/send-otp" \ -H "Content-Type: application/json" \ -d '{}'{ "status": true}Verify a backup code for two-factor authentication
Authorization
bearerAuth Session token from the set-auth-token response header (bearer plugin)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/auth/two-factor/verify-backup-code" \ -H "Content-Type: application/json" \ -d '{ "code": "string" }'{ "user": { "id": "string", "email": "user@example.com", "emailVerified": true, "name": "string", "image": "http://example.com", "twoFactorEnabled": true, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z" }, "session": { "token": "string", "userId": "string", "createdAt": "2019-08-24T14:15:22Z", "expiresAt": "2019-08-24T14:15:22Z" }}Verify two factor OTP
Authorization
bearerAuth Session token from the set-auth-token response header (bearer plugin)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/auth/two-factor/verify-otp" \ -H "Content-Type: application/json" \ -d '{ "code": "string" }'{ "token": "string", "user": { "id": "string", "email": "user@example.com", "emailVerified": true, "name": "string", "image": "http://example.com", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z" }}Verify two factor TOTP
Authorization
bearerAuth Session token from the set-auth-token response header (bearer plugin)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/auth/two-factor/verify-totp" \ -H "Content-Type: application/json" \ -d '{ "code": "string" }'{ "status": true}