Basic authentication
Use basic authentication to connect to an API using a username and password passed in the header.
Tip: If you need to add additional properties or validation to your connection, see x-ntx-connection-properties and x-ntx-connection-validation.
The following examples use basic authentication:
How to use basic authentication
To add basic authentication to your OpenAPI Specification:
- Add a securityDefinitions object before the final closing brace of your OpenAPI Specification.
 - Create an object inside the securityDefinitions object to define your basic authentication security.
 - Inside the object, add the property type with a value of basic.
 - Inside the HTTP method of each operation that requires basic authentication, add a security array.
 - Inside the security array, add an object containing a property with:
- The key of the security definition object you created earlier.
 - An empty array as the property's value.
 
 
Where to use basic authentication
Use basic authentication in:
- The securityDefinitions object.
 - The security array of each HTTP method that requires basic authentication.
 
{
  "swagger": "2.0",
  "host": "api.example.com",
  "schemes": [ "https" ],
  "produces": [ "application/json" ],
  "consumes": [ "application/json" ],
  "paths": {
    "/example": {
      "post": {
        "summary": "Example operation",
        "security": [
          {
            "myBasicAuth": []
          }
        ],
        "parameters": [...],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
  "securityDefinitions": {
    "myBasicAuth": {
      "type": "basic"
    }
  }
}