Descope Widgets

Introduction

Descope Widgets are embeddable components designed to facilitate the delegation of operations to your application's users. These widgets can be utilized in both B2B and B2C contexts, allowing your users to perform various tenant, user management, and project level operations from within the application itself. This may include management tasks intended for delegation to tenant administrators within a tenant-based framework or other self-service widgets tailored to user needs. Widgets are only able to be used with our client side SDKs.

Descope UI

Navigating to the widget page, lets you preview the widgets that are available:

Descope widgets in console.

  • You can click on the widgets to preview them and all of their functionalities.
  • To work with widgets you will require to click on "Sync" and upgrade your frontend SDK. This update may affect your flows’ screens, as it uses the same components. We advise validating they work as designed.

Inside preview mode you can see how the widget will look like on the client side, indluding actions and light/dark mode:

Descope widgets in preview action.

Descope widgets in preview dark mode.

Prerequisites

Management Widgets

In order for your customer to use the management widgets he must be:

  • Logged in a session
  • Have a role with the "User Admin" permission for the specific tenant (you can use the built-in "Tenant Admin" role)

Implementation

User Management Widget

If you would like to allow admins to manage users from within your application, you can use this widget. This widget not only presents user data but also enables the execution of various tasks by the customer, including:

  • Create a new user
  • Edit an existing user
  • Activate / disable an existing user
  • Reset an existing user's password
  • Remove an existing user's passkey
  • Delete an existing user
  • Note: Custom fields will also appear in the table.

Examples

Descope user management widget.
ReactAngularVue.jsNext.jsHTML
import { UserManagement } from '@descope/react-sdk';
...
  <UserManagement
    widgetId="user-management-widget"
    tenant="tenant-id"
  />
<user-management tenant="tenant-id" widgetId="user-management-widget" />
<template>
	<UserManagement tenant="tenant-id" widget-id="user-management-widget" />
</template>

<script setup>
import { UserManagement } from '@descope/vue-sdk';
</script>
import { UserManagement } from '@descope/nextjs-sdk';
...
  <UserManagement
    widgetId="user-management-widget"
    tenant="tenant-id"
  />
<!doctype html>
<html>
  <head>
  </head>
  <body>
    <script src="https://cdn.jsdelivr.net/npm/@descope/user-management-widget/dist/index.js"></script>

    <descope-user-management-widget
      tenant="tenant-id"
      project-id="project-id"
      widget-id="user-management-widget"
    ></descope-user-management-widget>
  </body>
</html>

Role Management Widget

If you would like to manage roles from within your application, you can use this widget. This widget not only presents information about existing roles but also enables the execution of various tasks by the customer, including:

  • Create a new role
  • Change an existing role's fields
  • Delete an existing role

Notes

  • The Editable field is determined by the user's access to the role - meaning that project-level roles are not editable by tenant level users.
  • You need to pre-define the permissions that the user can use, which are not editable in the widget.

Examples

Descope role management widget.
ReactAngularVue.jsNext.jsHTML
import { RoleManagement } from '@descope/react-sdk';
...
  <RoleManagement
    widgetId="role-management-widget"
    tenant="tenant-id"
  />
<role-management tenant="tenant-id" widgetId="role-management-widget" />
<template>
	<RoleManagement tenant="tenant-id" widget-id="role-management-widget" />
</template>

<script setup>
import { RoleManagement } from '@descope/vue-sdk';
</script>
import { RoleManagement } from '@descope/nextjs-sdk';
...
  <RoleManagement
    widgetId="role-management-widget"
    tenant="tenant-id"
  />
<!doctype html>
<html>
  <head>
  </head>
  <body>
    <script src="https://cdn.jsdelivr.net/npm/@descope/role-management-widget/dist/index.js"></script>

    <descope-role-management-widget
      tenant="tenant-id"
      project-id="project-id"
      widget-id="role-management-widget"
    ></descope-role-management-widget>
  </body>
</html>

Access Key Management Widget

If you would like to manage Access Keys from within your application, you can use this widget. This widget not only presents information about existing access keys but also enables the execution of various tasks, including:

  • Create a new access key
  • Activate / deactivate an existing access key
  • Delete an exising access key

Examples

Descope access key management widget.
ReactAngularVue.jsNext.jsHTML
import { AccessKeyManagement } from '@descope/react-sdk';
...
  <AccessKeyManagement
    widgetId="access-key-management-widget"
    tenant="tenant-id"
  />
<access-key-management tenant="tenant-id" widgetId="access-key-management-widget" />
<template>
	<AccessKeyManagement tenant="tenant-id" widget-id="access-key-management-widget" />
</template>

<script setup>
import { AccessKeyManagement } from '@descope/vue-sdk';
</script>
import { AccessKeyManagement } from '@descope/nextjs-sdk';
...
  <AccessKeyManagement
    widgetId="access-key-management-widget"
    tenant="tenant-id"
  />
<!doctype html>
<html>
  <head>
  </head>
  <body>
    <script src="https://cdn.jsdelivr.net/npm/@descope/access-key-management-widget/dist/index.js"></script>

    <descope-access-key-management-widget
      tenant="tenant-id"
      project-id="project-id"
      widget-id="access-key-management-widget"
    ></descope-access-key-management-widget>
  </body>
</html>

User Access Key Management Widget

If you would like to expose Access Keys to your tenant users from within your application, you can use this widget. This widget not only presents information about user-associated access keys but also enables the execution of various tasks by the user, including:

  • Create a new access key
  • Activate / deactivate an existing access key
  • Delete an exising access key

Notes

  • Users will see only their own access keys, for the tenant they are logged into.

Examples

Descope user access key management widget.
ReactAngularVue.jsNext.jsHTML
import { UserAccessKeyManagement } from '@descope/react-sdk';
...
  <UserAccessKeyManagement
    widgetId="user-access-key-management-widget"
    tenant="tenant-id"
  />
<user-access-key-management tenant="tenant-id" widgetId="user-access-key-management-widget" />
<template>
	<UserAccessKeyManagement tenant="tenant-id" widget-id="user-access-key-management-widget" />
</template>

<script setup>
import { UserAccessKeyManagement } from '@descope/vue-sdk';
</script>
import { UserAccessKeyManagement } from '@descope/nextjs-sdk';
...
  <UserAccessKeyManagement
    widgetId="user-access-key-management-widget"
    tenant="tenant-id"
  />
<!doctype html>
<html>
  <head>
  </head>
  <body>
    <script src="https://cdn.jsdelivr.net/npm/@descope/user-access-key-management-widget/dist/index.js"></script>

    <descope-user-access-key-management-widget
      tenant="tenant-id"
      project-id="project-id"
      widget-id="user-access-key-management-widget"
    ></descope-user-access-key-management-widget>
  </body>
</html>

Audit Widget

Some customers need an audit trail to monitor their users and check who performed a specific action. Embedding the audit table widget on your site automates the process of exposing that audit trail to your customers. The widget includes all tenant authentication events and custom audit events you might need to create for your customers.

Examples

Descope audit management widget.
ReactAngularVue.jsNext.jsHTML
import { AuditManagement } from '@descope/react-sdk';
...
  <AuditManagement
    widgetId="access-key-management-widget"
    tenant="tenant-id"
  />
<audit-management tenant="tenant-id" widgetId="audit-management-widget" />
<template>
	<AuditManagement tenant="tenant-id" widget-id="audit-management-widget" />
</template>

<script setup>
import { AuditManagement } from '@descope/vue-sdk';
</script>
import { AuditManagement } from '@descope/nextjs-sdk';
...
  <AuditManagement
    widgetId="audit-management-widget"
    tenant="tenant-id"
  />
<!doctype html>
<html>
  <head>
  </head>
  <body>
  <script src="https://cdn.jsdelivr.net/npm/@descope/audit-management-widget/dist/index.js"></script>
    <descope-audit-management-widget
      tenant="tenant-id"
      project-id="project-id"
      widget-id="audit-management-widget"
  ></descope-audit-management-widget>
  </body>
</html>

Create Audit Events

The tenant authentication events are displayed in the widget by default. At some point in your customer's lifecycle, you will need to add more and more events to support your product's transparency. With Descope, you can create audit events using the management api. Here is a quick example in Node.JS of how you can create an audit event and for it to be reflected in the widget:

await descopeClient.management.audit.createEvent({
  action: 'user.updated',
  type: 'info', // info/warn/error
  actorId: 'UXXX',
  tenantId: 'tenant-id',
  data: {
    some: 'data',
  },
});