Gamma API

Verify a backup code

POST
/api/auth/two-factor/verify-backup-code

Verify a backup code for two-factor authentication

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
code*string

A backup code to verify. Eg: "123456"

disableSession?boolean

If true, the session cookie will not be set.

trustDevice?boolean

If true, the device will be trusted for 30 days. It'll be refreshed on every sign in request within this time. Eg: true

Response Body

Backup code verified successfully

application/json
  1. response
user*

The authenticated user object with two-factor details

session*

The current session object, included unless disableSession is true

Example Request
curl -X POST 'http://localhost:3000/api/auth/two-factor/verify-backup-code' \  -H 'Content-Type: application/json' \  -d '{  "code": "string"}'
Example Response
{  "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"  }}