Gamma API

Enable two-factor

POST
/api/auth/two-factor/enable

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

session
cookiegamma.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.

Request Body

application/json
  1. body
password?string

User password

method?string
Value in"otp""totp"
issuer?string

Custom issuer for the TOTP URI

Response Body

Successful response

application/json
  1. response
method*string

The 2FA method that was enabled.

Value in"otp""totp"
totpURI?string

TOTP 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"  ]}