@stackfactor/client-api 1.1.81 → 1.1.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,14 @@
1
1
  import axios from "axios";
2
2
  import { RESPONSE_TYPE } from "./constants.js";
3
- import https from "https";
4
3
  import utils from "./utils.js";
5
4
 
6
5
  const baseUrl = utils.getBaseUrl();
7
6
 
8
7
  const client = axios.create({
9
8
  baseURL: baseUrl,
10
- httpsAgent: new https.Agent({
11
- rejectUnauthorized: false,
12
- }),
9
+ withCredentials: true,
13
10
  });
14
11
 
15
- client.defaults.withCredentials = true;
16
-
17
12
  /**
18
13
  * Returns the error as a string
19
14
  * @param {Object} error
package/lib/users.js CHANGED
@@ -391,14 +391,13 @@ const login = (email, password, rememberMe) => {
391
391
 
392
392
  /**
393
393
  * Logout from the server. It returns a promise
394
- * @param {String} token Authorization token
394
+ * @param {String} refreshToken Authorization token
395
395
  */
396
- const logout = (token) => {
396
+ const logout = (refreshToken) => {
397
397
  return new Promise(function (resolve, reject) {
398
- const options = {
399
- headers: { authorization: token },
400
- };
401
- let request = client.post("api/v1/auth/logout", {}, options);
398
+ let request = client.post("api/v1/auth/logout", {
399
+ refreshToken,
400
+ });
402
401
  request
403
402
  .then((response) => {
404
403
  resolve(response.data);
@@ -414,10 +413,9 @@ const logout = (token) => {
414
413
  * a new token can be restablished using login
415
414
  * @param {String} token User's auth token to be refreshed
416
415
  */
417
- const refreshToken = (token) => {
416
+ const refreshToken = (refreshToken) => {
418
417
  return new Promise(function (resolve, reject) {
419
- let options = { headers: { authorization: token } };
420
- let request = client.post("api/v1/auth/refreshToken", {}, options);
418
+ let request = client.post("api/v1/auth/refreshToken", { refreshToken });
421
419
  request
422
420
  .then((response) => {
423
421
  resolve(response.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackfactor/client-api",
3
- "version": "1.1.81",
3
+ "version": "1.1.83",
4
4
  "description": "Node.js library for the StackFactor API",
5
5
  "main": "index.js",
6
6
  "exports": {