GXS Internal
Identity serverAPI reference

Two-factor

/two-factor/get-totp-uri

POST
/two-factor/get-totp-uri

Authorization

bearerAuth
headerAuthorizationBearer <token>

Bearer token authentication

Request Body

application/json
  1. body
password?string

User password

Response Body

Successful response

application/json
  1. response
totpURI?string
curl -X POST 'https://dev.auth.graphxserver.io/api/auth/two-factor/get-totp-uri' \  -H 'Content-Type: application/json' \  -d '{}'
{  "totpURI": "string"}

/two-factor/verify-totp

POST
/two-factor/verify-totp

Authorization

bearerAuth
headerAuthorizationBearer <token>

Bearer token authentication

Request Body

application/json
  1. body
code*string

The otp code to verify. Eg: "012345"

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

Successful response

application/json
  1. response
status?boolean
curl -X POST 'https://dev.auth.graphxserver.io/api/auth/two-factor/verify-totp' \  -H 'Content-Type: application/json' \  -d '{  "code": "string"}'
{  "status": true}

/two-factor/send-otp

POST
/two-factor/send-otp

Authorization

bearerAuth
headerAuthorizationBearer <token>

Bearer token authentication

Request Body

application/json
  1. body
trustDevice?boolean

Response Body

Successful response

application/json
  1. response
status?boolean
curl -X POST 'https://dev.auth.graphxserver.io/api/auth/two-factor/send-otp' \  -H 'Content-Type: application/json' \  -d '{}'
{  "status": true}

/two-factor/verify-otp

POST
/two-factor/verify-otp

Authorization

bearerAuth
headerAuthorizationBearer <token>

Bearer token authentication

Request Body

application/json
  1. body
code*string

The otp code to verify. Eg: "012345"

trustDevice?boolean

Response Body

Two-factor OTP verified successfully

application/json
  1. response
token*string

Session token for the authenticated session

user*

The authenticated user object

curl -X POST 'https://dev.auth.graphxserver.io/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"  }}
POST
/two-factor/verify-backup-code

Authorization

bearerAuth
headerAuthorizationBearer <token>

Bearer token authentication

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

curl -X POST 'https://dev.auth.graphxserver.io/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"  }}
POST
/two-factor/generate-backup-codes

Authorization

bearerAuth
headerAuthorizationBearer <token>

Bearer token authentication

Request Body

application/json
  1. body
password?string

The users password.

Response Body

Backup codes generated successfully

application/json
  1. response
status*true

Indicates if the backup codes were generated successfully

Value intrue
backupCodes*array<string>

Array of generated backup codes in plain text

curl -X POST 'https://dev.auth.graphxserver.io/api/auth/two-factor/generate-backup-codes' \  -H 'Content-Type: application/json' \  -d '{}'
{  "status": true,  "backupCodes": [    "string"  ]}

/two-factor/enable

POST
/two-factor/enable

Authorization

bearerAuth
headerAuthorizationBearer <token>

Bearer token authentication

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'.

curl -X POST 'https://dev.auth.graphxserver.io/api/auth/two-factor/enable' \  -H 'Content-Type: application/json' \  -d '{}'
{  "method": "otp",  "totpURI": "string",  "backupCodes": [    "string"  ]}

/two-factor/disable

POST
/two-factor/disable

Authorization

bearerAuth
headerAuthorizationBearer <token>

Bearer token authentication

Request Body

application/json
  1. body
password?string

User password

Response Body

Successful response

application/json
  1. response
status?boolean
curl -X POST 'https://dev.auth.graphxserver.io/api/auth/two-factor/disable' \  -H 'Content-Type: application/json' \  -d '{}'
{  "status": true}