Create A 3rd Party Authentication Token

Title

Create fixed date authentication token for 3rd party applications

URL Path

vault_rest/authenticate

Method

POST

Summary

This API allows you to create fixed expiry authentication tokens to be used by 3rd party applications.

Use Cases (used by)

Used by the user interface to create 3rd party authentication tokens under Generate Tokens page.

HTTP header parameters

Name

Value

Required

Description

Example

Authorization

The authentication token of the caller

REQUIRED

This header should have the following format:
Bearer [token obtained from authenticate API]
Example: Bearer Cp01BwnXAIOLZXxn7yogjKqIZnZpQD

POST /vault_rest/authenticate HTTP/1.1
Host: localhost:8000
Authorization: Bearer f3I8Vss3cWAuh3EscB06QRDcQfMzHY
Content-Type: application/json
 
{
"role" : "guest",
"expires" : "2018-07-15T04:14:50.0000000Z",
"description" : "Metadefender access token"
}

Method: POST

HTTP body

json

REQUIRED

Sample HTTP body
{
"role" : "guest",
"expires" : "2015-07-15T04:14:50.0000000Z",
"description" : "Metadefender access token"
}

Descriptions of body:

role

Role for this token

REQUIRED

Possible values are:

  • Guest

  • User

  • Administrator

expires

Token expiry date

REQUIRED

Specify a date+time (in UTC ISO-8601 format) when the token should expire.

description

Token description

OPTIONAL

Specify a description for the token.

Request Error

400

Bad Request

Invalid HTTP request

401

Invalid parameter

One or more parameters are invalid

403

Forbidden

Authentication token is incorrect

500

Internal Server Error

Server is temporarily unavailable

Response

Example of a successful scan request:

{
"expires": "2018-07-15T04:14:50.0000000Z",
"token": "OrRnBd9J0AzTiUe4Xrevj6IUoHbdMs",
"user_id": 1
}

Descriptions of response:

token

Authentication token that was created

expires

Date and time of token expiry

user_id

The id of the user associated with the token