Passing Credentials in Madbuild When Publishing Output

If you are using the command line to publish output from Flare Desktop to another location, you can include credentials (i.e., user names, passwords) in your madbuild commands. You can put credential fields directly in a madbuild command, or you can put them in a separate JSON file, which is easier to read.

Passing credentials in madbuild can be done for:

  • FTP

  • MadCap Flare Online

  • Salesforce®

  • ServiceNow®

  • SFTP

  • Zendesk

Note If a destination file is associated with a target, the output will automatically be published to that destination when using a madbuild command.

Credential Fields

Here are the supported credential fields.

Field

Description

username

The user name for basic authentication.

password

The password for basic authentication.

Note For Salesforce®, the password is that you use in a command is actually the password plus the token appended at the end of it. You can generate the token in Salesforce® from My Settings > Personal > Reset My Security Token.

Note For Zendesk, "Password Access" needs to be enabled from API settings in Zendesk in order for it to work.

Also, with Zendesk you have the option of using a token only, as opposed to using the username and password. For more details on this, see the following:

Copy
https://support.zendesk.com/hc/en-us/articles/203663836-Using-OAuth-authentication-with-your-application

Credential URL Formats

Here are the formats for including credential fields, depending on the type of destination.

Destination

Format

FTP and SFTP

Copy
https://[hosturl]/[directory]

Note This is the same as what you enter in the Host Name and Directory fields in the Destination Editor.

MadCap Flare Online

Copy
https://portal.madcapcentral.com/

Salesforce®

If your are publishing to a regular Salesforce® instance:

Copy
https://login.salesforce.com/services/oauth2/authorize

If you are publishing to a sandbox Salesforce® instance:

Copy
https://test.salesforce.com/services/oauth2/authorize

ServiceNow®

Copy
https://[instance].service-now.com/oauth_token.do

Zendesk

Copy
https://[subdomain].zendesk.com/oauth/authorizations/new

Passing Credentials in Madbuild Command

In this case, you put the credentials directly into your madbuild command.

Copy
madbuild -project "C:\MyProjectFolder\MyProject.flprj" -target "MyTargetName" 
-credentials  "{\"https://url.com/dir\": {\"username\":\"myusername\", \"password\": 
\"mypassword\"}, \"https://anotherurl.com/dir\": {\"username\":\"myusername\"
\"password\":\"mypassword\"} }"

Example – FTP

Copy
madbuild -project "C:\CoolProject\CoolProject.flprj" -target "HelpSystem" 
-credentials  "{\"https://docs.fictionsoft.com/flareoutputs/helpsystem\": 
{\"username\":\"ldobler\", \"password\": \"sayanything\"} }"

Example – MadCap Flare Online

Copy
madbuild -project "C:\CoolProject\CoolProject.flprj" -target "HelpSystem" 
-credentials  "{\"https://portal.madcapcentral.com/\": 
{\"username\":\"breynolds@fictionsoft.com\", \"password\": \"Bandit77!\"} }"

Example – Salesforce®

Copy
madbuild -project "C:\CoolProject\CoolProject.flprj" -target "HelpSystem" 
-credentials  "{\"https://login.salesforce.com/services/oauth2/authorize\": 
{\"username\":\"pete@fictionsoft.com\", \"password\"
\"HeDoneRunnoft!Fj4bGioaIWS9OPakVCedIjk2\"} }"

Example – ServiceNow®

Copy
madbuild -project "C:\CoolProject\CoolProject.flprj" -target "HelpSystem" 
-credentials  "{\"https://docs52164.service-now.com/oauth_token.do\": 
{\"username\":\"steve.zissou\", \"password\": \"CompanyBondStooge!\"} }"

Example – SFTP

Copy
madbuild -project "C:\CoolProject\CoolProject.flprj" -target "HelpSystem" 
-credentials  "{\"https://myappserver05:0101/flareoutputs/helpsystem\": 
{\"username\":\"jlebowski\", \"password\": \"thedudeabides\"} }"

Example – Zendesk

Copy
madbuild -project "C:\CoolProject\CoolProject.flprj" -target "HelpSystem" 
-credentials  "{\"https://docs-fictionsoft.zendesk.com/oauth/authorizations/new\": 
{\"username\":\"westley@fictionsoft.com\", \"password\": \"AsYouWish!\"} }"

Example – Multiple Destinations (FTP and Salesforce®)

Copy
madbuild -project "C:\CoolProject\CoolProject.flprj" -target "HelpSystem" 
-credentials  "{\"https://docs.fictionsoft.com/flareoutputs/helpsystem\": 
{\"username\":\"ldobler\", \"password\": \"sayanything\"}, 
\"https://login.salesforce.com/services/oauth2/authorize\"
{\"username\":\"pete@fictionsoft.com\", \"password\"
\"HeDoneRunnoft!Fj4bGioaIWS9OPakVCedIjk2\"} }"

Passing Credentials in a JSON File

In this case, you put the credentials into a JSON file. Then, in your madbuild command, you point to that file.

One of the benefits of placing commands in a JSON file is that it is easier to include (and read) multiple sets of URLs and credential information in one place if you have that need.

JSON File

Copy
{
    "https://url.com/dir" : {
     "username": "myusername",
     "password": "mypassword"
    },
    
    "https://anotherurl/dir": {
     "username": "myusername",
     "password": "mypassword"
    }
}

Madbuild Command

Copy
madbuild -project "C:\MyProjectFolder\MyProject.flprj" -target "MyTargetName" 
-credentials-file "C:\MyCredentialsFolder\MyCredentialsFile.json"

Example — Multiple Destinations

You create a file named "DestinationCredentials.json" and save it in a folder called "My-JSON-Files," at your root C: drive. In the DestinationCredentials.json file, you create commands for the different kinds of destinations (FTP, Salesforce®, ServiceNow®, SFTP, Zendesk) that can be associated with one or more projects and targets. The JSON file looks like this.

Copy
{
  "https://docs.fictionsoft.com/flareoutputs/helpsystem" : {
  "username": "ldober",
  "password": "sayanything"
 },
 
 "https://portal.madcapcentral.com/" : {
 "username": "breynolds@fictionsoft.com",
 "password": "Bandit77!"
 },
  
  "https://login.salesforce.com/services/oauth2/authorize" : {
  "username": "pete@fictionsoft.com",
  "password": "HeDoneRunnoft!Fj4bGioaIWS9OPakVCedIjk2"
 },
  
  "https://docs52164.service-now.com/oauth_token.do" : {
  "username": "steve.zissou",
  "password": "CompanyBondStooge!"
 },
 
  "https://myappserver05:0101/flareoutputs/helpsystem" : {
  "username": "jlebowski",
  "password": "thedudeabides"
 },
 
  "https://docs-fictionsoft.zendesk.com/oauth/authorizations/new" : {
  "username": "westley@fictionsoft.com",
  "password": "AsYouWish!"
 }
}

Then, you create a madbuild command like this:

Copy
madbuild -project "C:\CoolProject\CoolProject.flprj" -target "HelpSystem" 
-credentials-file "C:\My-JSON-Files\DestinationCredentials.json"

When you run this command the output is generated for the "HelpSystem" target, and the output files are copied and placed in each of the locations specified in the JSON file.