AuthenticationTwo-factor authentication
Enable two-factor
POST
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.
sessioncookie
gamma.session_token<token>The session cookie a sign-in sets. Over HTTPS its name carries the __Secure- prefix. Browsers send it on their own; other clients keep it from the sign-in response.
application/json- body
password?stringUser password
method?stringValue in
"otp""totp"issuer?stringCustom issuer for the TOTP URI
Successful response
application/json- response
method*stringThe 2FA method that was enabled.
Value in
"otp""totp"totpURI?stringTOTP URI for authenticator app setup. Only present when method is 'totp'.
backupCodes?array<string>Recovery backup codes. Only present when method is 'totp'.
Example Request
curl -X POST 'http://localhost:3000/api/auth/two-factor/enable' \ -H 'Content-Type: application/json' \ -d '{}'Example Response
{ "method": "otp", "totpURI": "string", "backupCodes": [ "string" ]}