@digione/node-custom-api 0.2.0-beta10 → 0.2.0-beta11
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/middlewares/accessToken.js +1 -0
- package/package.json +1 -1
- package/utils/auth.d.ts +3 -1
- package/utils/auth.js +2 -2
- package/utils/file.js +2 -0
|
@@ -31,6 +31,7 @@ const verifyAccessToken = (req, res, next) => tslib_1.__awaiter(void 0, void 0,
|
|
|
31
31
|
}
|
|
32
32
|
res.locals.auth_id = data.id;
|
|
33
33
|
let setting = JSON.parse(tokenData['setting']);
|
|
34
|
+
res.locals.setting = setting;
|
|
34
35
|
res.locals.group_id = setting['group_id'];
|
|
35
36
|
res.locals.related_id = setting['organ_id'];
|
|
36
37
|
if (setting['b2b_group_id']) {
|
package/package.json
CHANGED
package/utils/auth.d.ts
CHANGED
|
@@ -15,7 +15,9 @@ export declare class AuthUtil {
|
|
|
15
15
|
success: number;
|
|
16
16
|
token: any;
|
|
17
17
|
}>;
|
|
18
|
-
refreshAccessTokenByToken(token: any
|
|
18
|
+
refreshAccessTokenByToken(token: any, { attributes_include }?: {
|
|
19
|
+
attributes_include?: any[];
|
|
20
|
+
}): Promise<{
|
|
19
21
|
access_token: string;
|
|
20
22
|
}>;
|
|
21
23
|
signNotificationTokenByToken(token: any, input?: any): Promise<{
|
package/utils/auth.js
CHANGED
|
@@ -75,7 +75,7 @@ class AuthUtil {
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
refreshAccessTokenByToken(token) {
|
|
78
|
+
refreshAccessTokenByToken(token, { attributes_include = [] } = {}) {
|
|
79
79
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
try {
|
|
81
81
|
const tokenData = yield (0, helper_1.getTokenDataFromTokenBySecret)(token, (0, helper_1.getENV)('JWT_SECRET'));
|
|
@@ -84,7 +84,7 @@ class AuthUtil {
|
|
|
84
84
|
yield access_token_1.AccessTokenModel.schema(this.ref, "_").destroy({
|
|
85
85
|
where: { refresh_token_id: refreshTokenId }
|
|
86
86
|
});
|
|
87
|
-
let include_access = {}, attributes = (this.ref == 'core') ? ['group_id'] : ['organ_id', 'group_id', 'b2b_group_id', 'team_id'];
|
|
87
|
+
let include_access = {}, attributes = (this.ref == 'core') ? ['group_id'] : ['organ_id', 'group_id', 'b2b_group_id', 'team_id'].concat(attributes_include);
|
|
88
88
|
let refresh = yield refresh_token_1.RefreshTokenModel.schema(this.ref, "_").findOne({
|
|
89
89
|
where: { id: refreshTokenId }, attributes, raw: true
|
|
90
90
|
});
|