@azteam/express 1.2.252 → 1.2.254

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.252",
3
+ "version": "1.2.254",
4
4
  "main": "src/index.js",
5
5
  "engines": {
6
6
  "node": ">= 12.0.0",
package/src/Server.js CHANGED
@@ -152,10 +152,11 @@ class Server {
152
152
  cors(function (req, callback) {
153
153
  const origin = req.header('Origin');
154
154
  const authorization = req.header('Authorization');
155
+ const appSecret = req.header('x-app-secret');
155
156
 
156
157
  let error = null;
157
158
 
158
- if (!authorization) {
159
+ if (!authorization && !appSecret) {
159
160
  if (!origin) {
160
161
  if (!isAllowEmptyOrigin) {
161
162
  error = new ErrorException(CORS, `Not allowed by CORS`);
@@ -41,8 +41,9 @@ export default function (cbLoginAPI) {
41
41
  const data = await cbLoginAPI(token);
42
42
  if (data) {
43
43
  req.user = data;
44
+ } else {
45
+ throw new ErrorException(TOKEN_FAILED);
44
46
  }
45
- return next();
46
47
  }
47
48
  }
48
49
  }