otp - Documentation

# otp

## User. otp

### Methods

#### (route) disable()

##### Route:

Method | Path
--- | ---
DELETE | /api/users/otp

Delete OTP for the user

##### Authentication

A authentication is needed to access this endpoint

##### Header Parameters:

Name | Type | Description
--- | --- | ---
Authorization | String | bearer access token issued for the user

##### Query Parameters:

Name | Type | Description
--- | --- | ---
otpToken | String | a currently valid OTP code

##### Response Code:

Type | Description
--- | ---
400 | missing parameters
403 | the code asked to remove the OTP from user account is invalid
500 | error from database
200 | the otp has been deleted for the user

#### (route) enable()

##### Route:

Method | Path
--- | ---
POST | /api/users/otp

Enable OTP for the user

##### Authentication

A authentication is needed to access this endpoint

##### Body Parameters:

Name | Type | Description
--- | --- | ---
otpKey | String | secret key used to generate OTP code
otpToken | String | a currently valid OTP code generated with the otpKey

##### Header Parameters:

Name | Type | Description
--- | --- | ---
Authorization | String | bearer access token issued for the user

##### Response Code:

Type | Description
--- | ---
400 | missing parameters
403 | the code asked to add the OTP from user account is invalid
500 | error from database
200 | the otp has been registered for the user

#### (route) retrieve()

##### Route:

Method | Path
--- | ---
GET | /api/users/otp

Get OTP state of the user account

##### Authentication

A authentication is needed to access this endpoint

##### Header Parameters:

Name | Type | Description
--- | --- | ---
Authorization | String | bearer access token issued for the user

##### Response:

Name | Type | Description
--- | --- | ---
user | Object | user model
key | String | otp secret key
qrImage | String | url to the QrCode

##### Response Code:

Type | Description
--- | ---
409 | the otp is already enabled for the user, you can only delete it
200 | the otp can be registered for the account, return the full response