Skip to main content

Release notes #0.1.129.0

Application Workbench​

The Authentication step of the application wizard is simplified: the Post Handler is removed, and the scripts now call the application themselves with api.send. The registration of an application by users is reworked to support the Context configuration questions.

What is new​

  • Registering an application with context questions. If the application has context questions, the user signs in first, then answers the questions one after another, and then finishes the registration. See Registering an application.
    • The button on the credentials screen is Save & Continue Authentication if the application has context questions, otherwise Save & Authenticate.
    • The questions are loaded in the order of the wizard. When an answer is changed, the questions below it are loaded again.
    • A question whose script fails shows "Invalid context setting". A required question that is empty shows "<name> is required".
    • On the last screen Save & Authenticate saves the answers and runs the Authorization script.
  • Application name when registering. The first field of the registration form is now Application name. It is required and is filled in with the name of the application, for example "Octopus Cloud". The user can change it, for example to tell two connections to different accounts apart. When a registered application is edited, the field shows its current name.
    • The name is saved with the registered application and is shown on its card, in the search of the list and in the notification email about a failed authentication.
    • It can still be changed later with Rename in the menu of the card.
    • Canvas adds this field itself: do not add a name field to the Credentials Configuration form.
  • Status of a registered application. The card shows new, ok or error. error is also shown when the application has context questions that have not been completed and authorized.
  • Documentation and Help for the Application Workbench. Every page of the Application Workbench now has help and a link to the documentation:
    • The Help button (top right of the page, or of the Preview panel on the right) opens a help panel for the current step: Applications workbench (the list), Basic information, Credentials configuration, Authentication, Context configuration, Re-Authentication, Authorization, Versions and Access. The same panel is available on the Registered applications list and on the page where a user registers an application.
    • Each help panel describes the purpose of the step, what triggers it and what the Preview shows, and ends with a More link to the full guide in this documentation: Application wizard, Applications list and Registering an application.
    • The Info button of the script editor of a context question (JS Config) opens the help for that script, and the small info icons near the step descriptions and Run with AI, if no configuration show a short tip.
  • Re-authentication: Sliding date time. On the Re-Authentication step, Trigger refreshing (session expiry) is Never, Fixed interval or Sliding date time. With Sliding date time the script decides when the next sign-in happens, by assigning utcNextAuth (UTC date and time in ISO format, for example from the token's expires_in).
    • The script must set a new utcNextAuth in every sign-in and renewal, in the Authentication script or in the custom refresh script, whichever runs. If it does not, the sign-in or renewal fails with SessionExpiryType is Sliding, but the script does not set a new utcNextAuth. Before, Canvas signed in again every minute in this case.
    • utcLastAuth is taken from the script only if the script changed it, otherwise it is the time of the sign-in.
    • Because the Post Handler is removed, set utcLastAuth and utcNextAuth in the Authentication script, not in a Post Handler.
    • Fixed interval: Canvas sets both times itself (next sign-in = now + Session timeout (minutes)). Values assigned by the script are ignored.
    • Never: no renewal is scheduled. Canvas takes utcLastAuth and utcNextAuth from the script if it changed them, otherwise the last sign-in is the time of the sign-in.
    • A renewal that fails is repeated after a growing pause: as many minutes as there have been failures in a row. After 12 failures in a row Canvas stops trying. The Test action on the registered application repeats the sign-in at once and resets the counter when it works.
    • Use custom refresh script: off - the Authentication script is repeated; on - your refresh script runs. The custom refresh script is not available for applications of the API Connector type.
  • api.send is simpler to use in all wizard scripts (api.send):
    • verb is optional and is GET by default.
    • baseUrl and requestUrl are each optional, but the full address built from them is required and must start with http:// or https://. If you set both, the address is baseUrl/requestUrl. If you set only one of them, it must be the full address.
    • The error for a missing address is now baseUrl or requestUrl is required in request: the full url must be set. A wrong address gives The full url (baseUrl + requestUrl) must start with http:// or https://.

What is changed​

  • The Authentication and Re-Authentication scripts call the application themselves with await api.send(...), check the answer and save the result to appVault and appVaultSecret. Canvas no longer sends a request that the script returns, and the script's return value is not used.
  • Because there is nothing to inspect, Canvas does not judge whether the sign-in was successful. api.send does not throw on a non-2xx answer: use getFullResponse: true, check statusCode and throw an error in your script.
  • The error "Your script doesn't produce a JSON object with obligatory 'verb'/'baseUrl' field(s)" no longer exists for the Authentication and Re-Authentication scripts.
  • The Authentication wizard page no longer has the Post Handler panel, and the Test tab runs only your Authentication script.
  • The response variable is not available in any script.
  • Versions. The postHandlerJS property is removed from authConfiguration in the version text, see Versions.
  • The default script that Canvas generates with Run with AI, if no configuration no longer includes a Post Handler.

Removed​

  • Post Handler (UCIN-1595, UCIN-1607). Put its code at the end of the Authentication script.

Check after the update​

  • Existing applications. The Authentication and Re-Authentication scripts that return a request for Canvas to send stop working as before: the request is not sent, and the Post Handler is not run. Rewrite such scripts to call api.send themselves and save the tokens to the vaults, as in the example below. These scripts are not converted automatically.
  • The Post Handler code of existing applications is no longer used. If it saved tokens or the baseUrl, move that code into the Authentication script.

Before:

// Authentication script
return { verb: 'POST', baseUrl: 'https://api.example.com', requestUrl: 'login', data: { user: config.username } };

// Post Handler
appVaultSecret.access_token = response.content.access_token;

After:

if (!appVault) appVault = {};
if (!appVaultSecret) appVaultSecret = {};

const response = await api.send({
verb: 'POST',
baseUrl: 'https://api.example.com',
requestUrl: 'login',
data: { user: config.username },
getFullResponse: true
});

if (response.statusCode !== 200 || !response.content) {
throw new Error(`Sign-in failed: ${response.statusCode}`);
}
appVaultSecret.access_token = response.content.access_token;

Documentation​