The Credentials Object specifies how a user can grant a component the access to his protected resources using API. If the authentication is done via HTTP headers (e.g. Basic Authorization), then it is sufficient to define a single input field (TextFieldView - check the View Classes for more) to input the API key.

If OAuth 1.0 or 2.0 is used, then View Class OAuthFieldView is required and a corresponding property OAuth1 or OAuth2. Again check the View Classes for the exact implementation.

Property Name Type Required Description
fields object Yes Input fields used to provide credentials for Authentication. Each property of this object defines a name of a configuration property. The value of a field property is a Fields Object which specifies how to display an input field to be used by a user to enter a value for a configuration property.
oauth1 object
Specifies the APIs details about Authenticating with OAuth 1.0
oauth2 object
Specifies the APIs details about Authenticating with OAuth 2.0

The following examples demonstrate extracts from the different component descriptors for APIs that are using OAuth 1.0 or OAuth 2.0 to provide access to the protected resources:

OAuth1

{
"credentials" : {
   "fields":{
      "oauth":{
         "viewClass":"OAuthFieldView",
         "label":"Twitter Account",
         "required" : true
      }
   },
   "oauth1":{
      "consumer_key":"{{TWITTER_API_KEY}}",
      "consumer_secret":"{{TWITTER_API_SECRET}}",
      "request_token_uri":"https://api.twitter.com/oauth/request_token",
      "auth_uri":"https://api.twitter.com/oauth/authorize",
      "access_token_uri":"https://api.twitter.com/oauth/access_token"
   }
}

More information is presented in separate document about OAuth1.

OAuth2

{
"credentials" : {
   "fields":{
      "oauth":{
         "viewClass":"OAuthFieldView",
         "label":"Twitter Account",
         "required" : true
      }
   },
   "oauth2":{
      "client_id":"{{SALESFORCE_KEY}}",
      "client_secret":"{{SALESFORCE_SECRET}}",
      "auth_uri":"https://login.salesforce.com//services/oauth2/authorize",
      "token_uri":"https://login.salesforce.com/services/oauth2/token"
   }
}

More information is presented in separate document about OAuth2.

Any object implementation is directly connected with one or several View Class definitions, therefore it is advisable to check them as well.