Credentials in Component.json

The credentials object is used to expose the information that the platform needs to collect from the integrator in order to be able to connect to their instance/account. Information that is collected in this section typically include:

  • URL to the integrator’s instance (if there is not a shared cloud URL)
  • Username or other account identifier
  • Password or other API keys/tokens required to authenticate

What do credentials represent

Whenever an integrator uses your component on the elastic.io platform, they will need create a credentials object where they must provide values for each of the fields asked for in the credentials part of the component.

Once these values have been provided, these values will be available to the component’s code in all actions, triggers and related helper functions.

In addition to the fields identified in component.json, the platform will also prompt the integrator to assign a name to their credential. An integrator may have more than one credential for a given component if the integrator has multiple accounts or instances for system the component is built for.

Example Credentials for the Magento 2 Component

Omitting Credentials

If the credentials object is not provided, then the integrator will not have the ability to select a credentials object between the Functions tab and the Input tab.

Example of No Credentials

If the credentials object is provided and is {} or is {"fields": {}} then the integrator will have the ability to select a credentials object although there will be no inputs for the integrator to fill in apart from a credential name.

Example of Empty Credentials

Credentials Object Structure

The credentials should be an object with the following properties:

Property Name Description
fields An object which describes the fields in the credential. See the article on fields for more information.
verifier Java components only Identifies the Java class to be invoked by specifying the fully qualified name of a Java class which inherits the io.elastic.api.CredentialsVerifier class.
oauth1 Specifies the details about OAuth v1.0 resources. Only used if a OAuthFieldView field is defined.
oauth2 Specifies the details about OAuth v2.0 resources. Only used if a OAuthFieldView field is defined.

Example

(Example credentials from the Magento 2 component.json)

{
    "title": "Your Title",
    "description": "Your Description",
    "buildType": "Your BuildType",
    "credentials": {
        "fields": {
            "minorVersion": {
                "viewClass": "SelectView",
                "label": "Minor Version of Magento",
                "required": true,
                "placeholder": "Choose version of Magento",
                "model": {
                    "2": "v2.2",
                    "3": "v2.3"
                }
            },
            "edition": {
                "viewClass": "SelectView",
                "label": "Magento Edition",
                "required": true,
                "placeholder": "Choose environment",
                "model": {
                    "openSource": "Open source",
                    "enterprise": "Enterprise"
                }
            },
            "url": {
                "viewClass": "TextFieldView",
                "label": "URL",
                "required": true,
                "placeholder": "Instance URL"
            },
            "username": {
                "viewClass": "TextFieldView",
                "label": "Username",
                "required": false,
                "placeholder": "Paste username"
            },
            "password": {
                "viewClass": "PasswordFieldView",
                "label": "Password",
                "required": false,
                "placeholder": "Paste password"
            },
            "integrationToken": {
                "viewClass": "PasswordFieldView",
                "label": "Integration Token",
                "required": false,
                "placeholder": "Paste Integration Token"
            }
        }
    },
    "triggers": {
      "first_trigger": "First Trigger"
    },
    "actions": {
      "first_action": "First Action"
    }
}