@fraym/auth 0.5.0 → 0.5.1
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/util/token.js +3 -3
- package/package.json +2 -1
package/dist/util/token.js
CHANGED
|
@@ -46,12 +46,12 @@ const getTokenData = async (appSecret, token, requireUserId = true) => {
|
|
|
46
46
|
if (!payload.exp) {
|
|
47
47
|
throw Error("expiration time is missing in JWT");
|
|
48
48
|
}
|
|
49
|
-
if (requireUserId && !payload.
|
|
50
|
-
throw Error("
|
|
49
|
+
if (requireUserId && !payload.sub) {
|
|
50
|
+
throw Error("user id (subject) is missing in JWT");
|
|
51
51
|
}
|
|
52
52
|
return {
|
|
53
53
|
scopes: (_a = payload.scopes) !== null && _a !== void 0 ? _a : [],
|
|
54
|
-
userId: (_b = payload.
|
|
54
|
+
userId: (_b = payload.sub) !== null && _b !== void 0 ? _b : "",
|
|
55
55
|
exp: payload.exp,
|
|
56
56
|
};
|
|
57
57
|
};
|