skapi-js 1.0.15 → 1.0.16-alpha
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/dist/skapi.js +1 -1
- package/dist/skapi.js.map +1 -1
- package/dist/skapi.module.js +1 -1
- package/dist/skapi.module.js.map +1 -1
- package/js/main/skapi.js +3 -3
- package/js/methods/user.js +19 -38
- package/package.json +1 -1
package/js/main/skapi.js
CHANGED
|
@@ -22,12 +22,12 @@ export default class Skapi {
|
|
|
22
22
|
set user(value) {
|
|
23
23
|
}
|
|
24
24
|
constructor(service, owner, options) {
|
|
25
|
-
this.version = '1.0.
|
|
25
|
+
this.version = '1.0.16-alpha';
|
|
26
26
|
this.session = null;
|
|
27
27
|
this.connection = null;
|
|
28
28
|
this.host = 'skapi';
|
|
29
|
-
this.hostDomain = 'skapi.
|
|
30
|
-
this.target_cdn = '
|
|
29
|
+
this.hostDomain = 'skapi.app';
|
|
30
|
+
this.target_cdn = 'd1wrj5ymxrt2ir';
|
|
31
31
|
this.__disabledAccount = null;
|
|
32
32
|
this.__cached_requests = {};
|
|
33
33
|
this.__startKeyHistory = {};
|
package/js/methods/user.js
CHANGED
|
@@ -143,49 +143,30 @@ export function authentication() {
|
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
if (refreshToken || !session.isValid()) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (idToken['custom:service'] !== this.service) {
|
|
150
|
-
cognitoUser.signOut();
|
|
151
|
-
this.session = null;
|
|
152
|
-
signedOut = true;
|
|
153
|
-
res(null);
|
|
146
|
+
cognitoUser.refreshSession(session.getRefreshToken(), (refreshErr, refreshedSession) => {
|
|
147
|
+
if (refreshErr) {
|
|
148
|
+
rej(refreshErr);
|
|
154
149
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
cognitoUser.refreshSession(session.getRefreshToken(), (refreshErr, refreshedSession) => {
|
|
160
|
-
if (refreshErr)
|
|
161
|
-
rej(refreshErr);
|
|
150
|
+
else {
|
|
151
|
+
if (!refreshedSession.isValid()) {
|
|
152
|
+
session = refreshedSession;
|
|
153
|
+
}
|
|
162
154
|
else {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
normalizeUserAttributes(refreshedSession.getIdToken().payload);
|
|
166
|
-
res(refreshedSession);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
rej(new SkapiError('Invalid session.', { code: 'INVALID_REQUEST' }));
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
155
|
+
rej(new SkapiError('Invalid session.', { code: 'INVALID_REQUEST' }));
|
|
156
|
+
return;
|
|
172
157
|
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
175
160
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
this.session = session;
|
|
185
|
-
normalizeUserAttributes(idToken);
|
|
186
|
-
res(session);
|
|
187
|
-
}
|
|
161
|
+
let idToken = session.getIdToken().payload;
|
|
162
|
+
if (idToken['custom:service'] !== this.service) {
|
|
163
|
+
cognitoUser.signOut();
|
|
164
|
+
this.session = null;
|
|
165
|
+
rej(new SkapiError('Invalid session.', { code: 'INVALID_REQUEST' }));
|
|
166
|
+
return;
|
|
188
167
|
}
|
|
168
|
+
normalizeUserAttributes(idToken);
|
|
169
|
+
res(session);
|
|
189
170
|
});
|
|
190
171
|
});
|
|
191
172
|
};
|
package/package.json
CHANGED