@azteam/express 1.2.253 → 1.2.255

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.253",
3
+ "version": "1.2.255",
4
4
  "main": "src/index.js",
5
5
  "engines": {
6
6
  "node": ">= 12.0.0",
package/src/Server.js CHANGED
@@ -153,10 +153,10 @@ class Server {
153
153
  const origin = req.header('Origin');
154
154
  const authorization = req.header('Authorization');
155
155
  const appSecret = req.header('x-app-secret');
156
+ const agent = req.header('User-Agent');
156
157
 
157
158
  let error = null;
158
-
159
- if (!authorization && !appSecret) {
159
+ if (!authorization && !appSecret && !agent.startsWith('toda')) {
160
160
  if (!origin) {
161
161
  if (!isAllowEmptyOrigin) {
162
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
  }