New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@descope/vue-sdk

Package Overview
Dependencies
Maintainers
3
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@descope/vue-sdk - npm Package Compare versions

Comparing version 0.0.0-next-d0a557a5-20230802 to 0.0.0-next-d3b7ecbc-20240411

22

package.json
{
"name": "@descope/vue-sdk",
"version": "0.0.0-next-d0a557a5-20230802",
"version": "0.0.0-next-d3b7ecbc-20240411",
"main": "dist/index.cjs",

@@ -9,4 +9,10 @@ "module": "dist/index.mjs",

"exports": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.cjs"
},
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
}
},

@@ -18,3 +24,3 @@ "types": "dist/index.d.ts",

"scripts": {
"start": "vue-cli-service serve",
"start": "vue-cli-service serve --port 3000",
"build": "rollup -m -c rollup.config.js",

@@ -36,3 +42,7 @@ "test": "vue-cli-service test:unit",

"dependencies": {
"@descope/web-component": "2.6.0"
"@descope/access-key-management-widget": "0.1.35",
"@descope/audit-management-widget": "0.1.0",
"@descope/role-management-widget": "0.1.35",
"@descope/user-management-widget": "0.4.36",
"@descope/web-component": "3.8.39"
},

@@ -43,3 +53,3 @@ "peerDependencies": {

"optionalDependencies": {
"@descope/web-js-sdk": "1.0.11"
"@descope/web-js-sdk": ">=1.10.24"
},

@@ -46,0 +56,0 @@ "devDependencies": {

@@ -43,14 +43,19 @@ # Descope Vue SDK

<template>
<p v-if="isFlowLoading">Loading...</p>
<Descope
:flowId.prop="'my-flow-id'"
flowId="my-flow-id"
@success="handleSuccess"
@error="handleError"
@success="handleSuccess"
@ready="handleReady"
/>
<!-- additional props -->
<!-- :theme.prop="'dark'" theme can be "light", "dark" or "os", which auto select a theme based on the OS theme. Default is "light" -->
<!-- :debug.prop="true" debug can be set to true to enable debug mode -->
<!-- :tenant.prop="tenantId" tenant ID for SSO (SAML) login. If not provided, Descope will use the domain of available email to choose the tenant -->
<!-- :redirectUrl.prop="redirectUrl" Redirect URL for OAuth and SSO (will be used when redirecting back from the OAuth provider / IdP), or for "Magic Link" and "Enchanted Link" (will be used as a link in the message sent to the the user) -->
<!-- :autoFocus.prop="'skipFirstScreen'" autoFocus can be true, false or "skipFirstScreen". Default is true. - true: automatically focus on the first input of each screen - false: do not automatically focus on screen's inputs - "skipFirstScreen": automatically focus on the first input of each screen, except first screen -->
<!-- :errorTransformer.prop="errorTransformer" errorTransformer is a function that receives an error object and returns a string. The returned string will be displayed to the user. NOTE: errorTransformer is not required. If not provided, the error object will be displayed as is. -->
<!-- theme="dark" theme can be "light", "dark" or "os", which auto select a theme based on the OS theme. Default is "light" -->
<!-- v-bind:debug="true" debug can be set to true to enable debug mode -->
<!-- locale="en" locale can be any supported locale which the flow's screen translated to, if not provided, the locale is taken from the browser's locale. -->
<!-- tenant="tenantId" tenant ID for SSO (SAML) login. If not provided, Descope will use the domain of available email to choose the tenant -->
<!-- redirectUrl="redirectUrl" Redirect URL for OAuth and SSO (will be used when redirecting back from the OAuth provider / IdP), or for "Magic Link" and "Enchanted Link" (will be used as a link in the message sent to the the user) -->
<!-- autoFocus="skipFirstScreen" autoFocus can be true, false or "skipFirstScreen". Default is true. - true: automatically focus on the first input of each screen - false: do not automatically focus on screen's inputs - "skipFirstScreen": automatically focus on the first input of each screen, except first screen -->
<!-- errorTransformer="errorTransformer" errorTransformer is a function that receives an error object and returns a string. The returned string will be displayed to the user. NOTE: errorTransformer is not required. If not provided, the error object will be displayed as is. -->
<!-- form="{ email: 'test@domain.com' }" form is an object the initial form context that is used in screens inputs in the flow execution. Used to inject predifined input values on flow start such as custom inputs, custom attrbiutes and other inputs. Keys passed can be accessed in flows actions, conditions and screens prefixed with "form.". NOTE: form is not required. If not provided, 'form' context key will be empty before user input. -->
<!-- client="{ version: '1.2.3' }" client is an object the initial client context in the flow execution. Keys passed can be accessed in flows actions and conditions prefixed with "client.". NOTE: client is not required. If not provided, context key will be empty. -->
</template>

@@ -60,3 +65,10 @@

import { Descope } from '@descope/vue-sdk';
import { ref } from 'vue';
const isFlowLoading = ref(true);
const handleSuccess = (e) => {
console.log('Logged in!', e);
};
const handleError = (e) => {

@@ -66,4 +78,4 @@ console.log('Could not log in', e);

const handleSuccess = (e) => {
console.log('Logged in!', e);
const handleReady = () => {
isFlowLoading.value = false;
};

@@ -104,3 +116,3 @@

<script setup>
import { useDescope, useSession, useUser } from '../../src';
import { useDescope, useSession, useUser } from '@descope/vue-sdk';

@@ -207,2 +219,4 @@ const { isAuthenticated, isSessionLoading } = useSession();

`refresh(token = getRefreshToken())` - Force a refresh on current session token using an existing valid refresh token.
`isSessionTokenExpired(token = getSessionToken())` - Check whether the current session token is expired. Provide a session token if is not persisted.
`isRefreshTokenExpired(token = getRefreshToken())` - Check whether the current refresh token is expired. Provide a refresh token if is not persisted.
`getJwtRoles(token = getSessionToken(), tenant = '')` - Get current roles from an existing session token. Provide tenant id for specific tenant roles.

@@ -218,2 +232,119 @@ `getJwtPermissions(token = getSessionToken(), tenant = '')` - Fet current permissions from an existing session token. Provide tenant id for specific tenant permissions.

### Widgets
Widgets are components that allow you to expose management features for tenant-based implementation. In certain scenarios, your customers may require the capability to perform managerial actions independently, alleviating the necessity to contact you. Widgets serve as a feature enabling you to delegate these capabilities to your customers in a modular manner.
Important Note:
- For the user to be able to use the widget, they need to be assigned the `Tenant Admin` Role.
#### User Management
The `UserManagement` widget will let you embed a user table in your site to view and take action.
The widget lets you:
- 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 also appear in the table.
###### Usage
```vue
<template>
<UserManagement tenant="tenant-id" widget-id="user-management-widget" />
</template>
<script setup>
import { UserManagement } from '@descope/vue-sdk';
</script>
```
Example:
[Manage Users](./example/components/ManageUsers.vue)
#### Role Management
The `RoleManagement` widget will let you embed a role table in your site to view and take action.
The widget lets you:
- Create a new role
- Change an existing role's fields
- Delete an existing role
Note:
- 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.
###### Usage
```vue
<template>
<RoleManagement tenant="tenant-id" widget-id="role-management-widget" />
</template>
<script setup>
import { RoleManagement } from '@descope/vue-sdk';
</script>
```
Example:
[Manage Roles](./example/components/ManageRoles.vue)
#### Access Key Management
The `AccessKeyManagement` widget will let you embed an access key table in your site to view and take action.
The widget lets you:
- Create a new access key
- Activate / deactivate an existing access key
- Delete an exising access key
###### Usage
```vue
<template>
<AccessKeyManagement
tenant="tenant-id"
widget-id="access-key-management-widget"
/>
</template>
<script setup>
import { AccessKeyManagement } from '@descope/vue-sdk';
</script>
```
Example:
[Manage Access Keys](./example/components/ManageAccessKeys.vue)
#### Audit Management
The `AuditManagement` widget will let you embed an audit table in your site.
###### Usage
```vue
<template>
<AuditManagement tenant="tenant-id" widget-id="audit-management-widget" />
</template>
<script setup>
import { AuditManagement } from '@descope/vue-sdk';
</script>
```
Example:
[Manage Audit](./example/components/ManageAudit.vue)
## Code Example

@@ -225,3 +356,3 @@

To run the examples, set your `Project ID` by setting the `DESCOPE_PROJECT_ID` env var or directly
To run the examples, set your `Project ID` by setting the `VUE_APP_DESCOPE_PROJECT_ID` env var or directly
in the sample code.

@@ -245,2 +376,4 @@ Find your Project ID in the [Descope console](https://app.descope.com/settings/project).

Open your browser and navigate to [http://localhost:3000](http://localhost:3000).
### Example Optional Env Variables

@@ -266,2 +399,21 @@

## Q & A
### I updated the user in my backend, but the user / session token are not updated in the frontend
// adjust the answer to vue sdk
The Descope SDK caches the user and session token in the frontend. If you update the user in your backend (using Descope Management SDK/API for example), you can call `me` / `refresh` from `useDescope` hook to refresh the user and session token. Example:
```js
const sdk = useDescope();
const handleUpdateUser = () => {
myBackendUpdateUser().then(() => {
sdk.me();
// or
sdk.refresh();
});
};
```
## Learn More

@@ -268,0 +420,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc