Socket
Socket
Sign inDemoInstall

@ambassify/ambassify-client

Package Overview
Dependencies
7
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.2.1 to 3.2.2

16

CHANGELOG.md

@@ -14,4 +14,20 @@ # Changelog

## 3.2.2
## 3.2.1
## 3.2.1
## 3.2.1
## 3.2.1
## 3.2.1
## 3.2.1
## 3.2.1
## 3.2.1
## 3.2.0

@@ -18,0 +34,0 @@

5

lib/index.js

@@ -83,3 +83,5 @@ 'use strict';

tokenOptions = (0, _extends3.default)({}, tokenOptions, {
tokenOptions = (0, _extends3.default)({
include_refresh: true
}, tokenOptions, {
grant_type: 'ambassify:impersonate',

@@ -117,2 +119,3 @@ client_id: clientId,

tokenEndpoint: baseUrl.replace(/\/*$/, '') + '/token',
tokenAuthorization: guestToken ? 'Bearer ' + guestToken : undefined,

@@ -119,0 +122,0 @@ organization: tokenData && tokenData.oid

15

lib/refresh-token.js

@@ -91,3 +91,4 @@ 'use strict';

refreshToken = options.refreshToken,
tokenEndpoint = options.tokenEndpoint;
tokenEndpoint = options.tokenEndpoint,
tokenAuthorization = options.tokenAuthorization;

@@ -108,2 +109,4 @@

if (tokenAuthorization) reqOptions.headers.authorization = tokenAuthorization;
return fetch(tokenEndpoint, reqOptions);

@@ -116,3 +119,4 @@ }

refreshToken = options.refreshToken,
tokenEndpoint = options.tokenEndpoint;
tokenEndpoint = options.tokenEndpoint,
tokenAuthorization = options.tokenAuthorization;

@@ -133,2 +137,4 @@

if (tokenAuthorization) reqOptions.headers.authorization = tokenAuthorization;
return fetch(tokenEndpoint, reqOptions);

@@ -194,4 +200,5 @@ }

clientId = _ref3.clientId,
tokenEndpoint = _ref3.tokenEndpoint;
return clientId + strHash(token + refreshToken + tokenEndpoint);
tokenEndpoint = _ref3.tokenEndpoint,
tokenAuthorization = _ref3.tokenAuthorization;
return clientId + strHash(token + refreshToken + tokenEndpoint + tokenAuthorization);
},

@@ -198,0 +205,0 @@ rejectFailedPromise: true

{
"name": "@ambassify/ambassify-client",
"version": "3.2.1",
"version": "3.2.2",
"description": "Base API client library for all Ambassify clients",

@@ -57,3 +57,3 @@ "engines": {

"homepage": "https://github.com/ambassify/api-clients#readme",
"gitHead": "afdc46d9eac7ba693afb3f037980772658f9c5f2"
"gitHead": "16bf60d3a3970db08902018409e9ad1412bcf6f7"
}

@@ -28,2 +28,3 @@ const _get = require('lodash/get');

tokenOptions = {
include_refresh: true,
...tokenOptions,

@@ -59,2 +60,3 @@ grant_type: 'ambassify:impersonate',

tokenEndpoint: baseUrl.replace(/\/*$/, '') + '/token',
tokenAuthorization: guestToken ? `Bearer ${guestToken}` : undefined,

@@ -61,0 +63,0 @@ organization: tokenData && tokenData.oid,

@@ -40,3 +40,4 @@ const safeJson = require('@ambassify/json-parse-safe');

refreshToken,
tokenEndpoint
tokenEndpoint,
tokenAuthorization,
} = options;

@@ -57,2 +58,5 @@

if (tokenAuthorization)
reqOptions.headers.authorization = tokenAuthorization;
return fetch(tokenEndpoint, reqOptions);

@@ -66,3 +70,4 @@ }

refreshToken,
tokenEndpoint
tokenEndpoint,
tokenAuthorization,
} = options;

@@ -83,2 +88,5 @@

if (tokenAuthorization)
reqOptions.headers.authorization = tokenAuthorization;
return fetch(tokenEndpoint, reqOptions);

@@ -139,3 +147,9 @@ }

const doCachedRefreshToken = throttle(doRefreshToken, 5 * 60 * 1000, {
resolver: (f, { token, refreshToken, clientId, tokenEndpoint }) => clientId + strHash(token + refreshToken + tokenEndpoint),
resolver: (f, {
token,
refreshToken,
clientId,
tokenEndpoint,
tokenAuthorization,
}) => clientId + strHash(token + refreshToken + tokenEndpoint + tokenAuthorization),
rejectFailedPromise: true

@@ -142,0 +156,0 @@ });

@@ -47,3 +47,4 @@ 'use strict';

client_secret: 'very-secret',
organization_id: 1333
organization_id: 1333,
include_refresh: true,
})

@@ -50,0 +51,0 @@ .reply(200, () => ({

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc