Managing Descope Flows

This page is an overview of the helpful items that you may need when working with Descope flows. Details about keyboard shortcuts, importing and exporting flows, creating custom flows, and deleting flows will be covered here.

Flow Shortcuts

The details of available keyboard shortcuts within the flow editor are covered here.

Group Select

To group select items within the flow editor, hold shift and drag your cursor to capture the items you'd like. You can then move the flow items, or delete them by pressing the delete button.

Undo Action

To undo an action within the flow editor, press ctrl/cmd + z.

Redo Action

To redo an action within the flow editor, press ctrl/cmd + shift + l.

Reset Changes

To revert all changes within the flow editor, press ctrl/cmd + shift + l.

Delete Action

To delete a node within the descope flow, click on it, then press the delete key.

Save Changes

To save changes to a flow, press ctrl/cmd + s.

Copy Flow Screens and Actions Between Flows

Descope allows you to copy and paste actions, screens, etc between flows. You can select an item or group select multiple items via ctrl/cmd + c within one flow and then ctrl/cmd + v within another flow on another tab or window.

Creating Custom Flows

Descope allows you to create custom flows to meet your needs. You can create flows within the Descope console by clicking the + Flow button at the top right. You will then give the flow a name, and an ID. The ID will be used when referencing the flow from your frontend code.

Flow Deletion

Descope allows you to delete flows from your project. This can be done by selecting the flow(s) within the Descope console by the checkboxes on the left then the delete button at the top of the table, or by clicking the three dots on the right then selecting delete.

Note

Some of the out-of-the-box flows cannot be deleted. These flows are the step-up, sign-up-or-in, sign-up, and sign-in flows.

Disabling and Activating Flows

When you are not actively using a Flow you can disable it from the Console. This can be done by selecting the flow(s) within the Descope console by the checkboxes on the left then the disable button at the top of the table, or by clicking the three dots on the right selecting disable. The same process applies when you want to re-enable the flows, but select active.

Exporting and Importing Flows

Descope allows you to export and import flows between projects. This feature allows you to backup your current flows, or migrate them between your projects.

Export Flow(s) from the Console

Within the Descope console you can export a single flow by selecting the checkboxes on the left then selecting export at the top right of the table, or by clicking the three dots on the right selecting export. The same can also be done for multiple flows when you select multiple checkboxes before clicking export. This will export the flows within a zip file. You can also export a flow when you are in the flow editor by clicking the down arrow on the top right.

Import Flow(s) from the Console

Within the Descope console you can export a single flow by selecting the import button at the top left and selecting the flow's json file to import. You can also import multiple flows by using a zip file containing the flows you would like to upload. Do note that if the IDs are the same as the flows currently in the system, the existing flows will be overridden. You can also import a flow when you are in the flow editor by clicking the up arrow on the top right.

Exporting and Importing Flows from the Management SDK

The Descope SDK allows you to import and export flows individually.

Install SDK

Terminal
npm i --save @descope/node-sdk

Import and initialize Management SDK

import DescopeClient from '@descope/node-sdk';
 
const managementKey = "xxxx"
 
try{
    //  baseUrl="<URL>" // When initializing the Descope clientyou can also configure the baseUrl ex: https://auth.company.com  - this is useful when you utilize CNAME within your Descope project.
    const descopeClient = DescopeClient({ projectId: '__ProjectID__', managementKey: managementKey });
} catch (error) {
    // handle the error
    console.log("failed to initialize: " + error)
}
 
// Note that you can handle async operation failures and capture specific errors to customize errors.
//     An example can be found here: https://github.com/descope/node-sdk?tab=readme-ov-file#error-handling

List Flows

Use the code below to load all existing flows within the project:

// Args
//   None
 
const resp = await descopeClient.management.flow.list()
if (!resp.ok) {
  console.log(resp)
  console.log("Unable to load flows.")
  console.log("Status Code: " + resp.code)
  console.log("Error Code: " + resp.error.errorCode)
  console.log("Error Description: " + resp.error.errorDescription)
  console.log("Error Message: " + resp.error.errorMessage)
}
else {
  console.log("Successfully loaded flows.")
  console.log(resp.data)
}

Export Flow

Use the code below to export an existing flow by it's flow_id. These examples export to a file:

import * as fs from 'fs';
 
// Args
//   flowId (str): the flow id to export.
 
const flowId = "sign-up-or-in"
const resp = await descopeClient.management.flow.export(flowId)
if (!resp.ok) {
  console.log(resp)
  console.log("Unable to export flow.")
  console.log("Status Code: " + resp.code)
  console.log("Error Code: " + resp.error.errorCode)
  console.log("Error Description: " + resp.error.errorDescription)
  console.log("Error Message: " + resp.error.errorMessage)
}
else {
  console.log("Successfully exported flow.")
  console.log(resp.data)
  let data = JSON.stringify(resp.data, null, 2);
  fs.writeFile('sign-in.json', data, (err) => {
      if (err) throw err;
      console.log('Flow written to file');
  });
}

Import Flow

Use the code below to import a flow. These examples import from a file:

// Args
//   None
 
const resp = await descopeClient.management.flow.list()
if (!resp.ok) {
  console.log(resp)
  console.log("Unable to load flows.")
  console.log("Status Code: " + resp.code)
  console.log("Error Code: " + resp.error.errorCode)
  console.log("Error Description: " + resp.error.errorDescription)
  console.log("Error Message: " + resp.error.errorMessage)
}
else {
  console.log("Successfully loaded flows.")
  console.log(resp.data)
}
Was this helpful?

On this page