Tokens - Documentation

# Tokens

### Methods

#### (route) create()

##### Route:

Method | Path
--- | ---
PUT | /api/users/token/

Create a new refresh token with specific premision

##### Authentication

A authentication is needed to access this endpoint

##### Body Parameters:

Name | Type | Description
--- | --- | ---
scope | Object | a valid oauth scope

##### Header Parameters:

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

##### Response:

Name | Type | Description
--- | --- | ---
. | Object | generated token

##### 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

#### (route) remove(:id)

##### Route:

Method | Path
--- | ---
DELETE | /api/users/token/:id

Delete a specific refresh token for current account

##### Authentication

A authentication is needed to access this endpoint

##### Header Parameters:

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

##### Route Parameters:

Name | Type | Description
--- | --- | ---
:id | String | token id

##### Response:

Name | Type | Description
--- | --- | ---
. | Object | array of tokens

##### Response Code:

Type | Description
--- | ---
500 | database error
404 | token not found
200 | refresh token has been deleted and all access token that have been created with it

##### Parameters:

Name | Type | Description
--- | --- | ---
`:id` |  | token id

#### (route) retrieve()

##### Route:

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

Retrieve list of tokens active for current 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
--- | --- | ---
. | Object | array of tokens

##### Response Code:

Type | Description
--- | ---
500 | database error
200 | successfully retrieved