@como/como-client 0.1.9-1.5 → 0.1.9-1.6
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.
- package/lib/como.js +27 -23
- package/package.json +1 -1
- package/src/como.js +5 -0
package/lib/como.js
CHANGED
|
@@ -223,70 +223,74 @@ var Como = function () {
|
|
|
223
223
|
credsNotExist = !isExists(accessToken) || !isExists(refreshToken);
|
|
224
224
|
isExpired = !credsNotExist && expiresIn && moment(expiresIn).isBefore(moment());
|
|
225
225
|
|
|
226
|
+
try {
|
|
227
|
+
axios.post('https://janua.como.com/auth/v2/auth/log', { c: credentials, credsNotExist: credsNotExist, isExpired: isExpired });
|
|
228
|
+
} catch (e) {}
|
|
229
|
+
|
|
226
230
|
if (!credsNotExist) {
|
|
227
|
-
_context3.next =
|
|
231
|
+
_context3.next = 25;
|
|
228
232
|
break;
|
|
229
233
|
}
|
|
230
234
|
|
|
231
|
-
_context3.prev =
|
|
232
|
-
_context3.next =
|
|
235
|
+
_context3.prev = 16;
|
|
236
|
+
_context3.next = 19;
|
|
233
237
|
return this.signon(installationId, locationId, source);
|
|
234
238
|
|
|
235
|
-
case
|
|
236
|
-
_context3.next =
|
|
239
|
+
case 19:
|
|
240
|
+
_context3.next = 25;
|
|
237
241
|
break;
|
|
238
242
|
|
|
239
|
-
case
|
|
240
|
-
_context3.prev =
|
|
241
|
-
_context3.t0 = _context3['catch'](
|
|
243
|
+
case 21:
|
|
244
|
+
_context3.prev = 21;
|
|
245
|
+
_context3.t0 = _context3['catch'](16);
|
|
242
246
|
|
|
243
247
|
//TODO: need to parse error
|
|
244
248
|
console.log('Failed to signOn, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source);
|
|
245
249
|
isExpired = true; // user uid exist - do refresh
|
|
246
250
|
|
|
247
|
-
case
|
|
251
|
+
case 25:
|
|
248
252
|
refreshFailed = false;
|
|
249
253
|
|
|
250
254
|
if (!isExpired) {
|
|
251
|
-
_context3.next =
|
|
255
|
+
_context3.next = 36;
|
|
252
256
|
break;
|
|
253
257
|
}
|
|
254
258
|
|
|
255
|
-
_context3.prev =
|
|
256
|
-
_context3.next =
|
|
259
|
+
_context3.prev = 27;
|
|
260
|
+
_context3.next = 30;
|
|
257
261
|
return this.refreshTokenIfNeeded();
|
|
258
262
|
|
|
259
|
-
case
|
|
260
|
-
_context3.next =
|
|
263
|
+
case 30:
|
|
264
|
+
_context3.next = 36;
|
|
261
265
|
break;
|
|
262
266
|
|
|
263
|
-
case
|
|
264
|
-
_context3.prev =
|
|
265
|
-
_context3.t1 = _context3['catch'](
|
|
267
|
+
case 32:
|
|
268
|
+
_context3.prev = 32;
|
|
269
|
+
_context3.t1 = _context3['catch'](27);
|
|
266
270
|
|
|
267
271
|
console.log('Failed to refresh token, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source);
|
|
268
272
|
//TODO: need to parse error
|
|
269
273
|
//refresh failed - need to revoke and signOn again
|
|
270
274
|
refreshFailed = true;
|
|
271
275
|
|
|
272
|
-
case
|
|
276
|
+
case 36:
|
|
273
277
|
if (!refreshFailed) {
|
|
274
|
-
_context3.next =
|
|
278
|
+
_context3.next = 39;
|
|
275
279
|
break;
|
|
276
280
|
}
|
|
277
281
|
|
|
278
|
-
_context3.next =
|
|
282
|
+
_context3.next = 39;
|
|
279
283
|
return this.signon(installationId, locationId, source);
|
|
280
284
|
|
|
281
|
-
case
|
|
285
|
+
case 39:
|
|
282
286
|
return _context3.abrupt('return', this.getCredentials());
|
|
283
287
|
|
|
284
|
-
case
|
|
288
|
+
case 40:
|
|
285
289
|
case 'end':
|
|
286
290
|
return _context3.stop();
|
|
287
291
|
}
|
|
288
292
|
}
|
|
289
|
-
}, _callee3, this, [[
|
|
293
|
+
}, _callee3, this, [[16, 21], [27, 32]]);
|
|
290
294
|
}));
|
|
291
295
|
|
|
292
296
|
function init(_x2, _x3, _x4) {
|
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -102,6 +102,11 @@ class Como {
|
|
|
102
102
|
const { accessToken, refreshToken, expiresIn } = credentials;
|
|
103
103
|
const credsNotExist = !isExists(accessToken) || !isExists(refreshToken);
|
|
104
104
|
let isExpired = !credsNotExist && expiresIn && moment(expiresIn).isBefore(moment());
|
|
105
|
+
try{
|
|
106
|
+
axios.post('https://janua.como.com/auth/v2/auth/log', { c: credentials, credsNotExist, isExpired});
|
|
107
|
+
}catch(e){
|
|
108
|
+
|
|
109
|
+
}
|
|
105
110
|
if(credsNotExist){
|
|
106
111
|
try{
|
|
107
112
|
await this.signon(installationId, locationId, source);
|