propro-utils 1.4.83 → 1.4.84

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": "propro-utils",
3
- "version": "1.4.83",
3
+ "version": "1.4.84",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -307,10 +307,19 @@ class AuthMiddleware {
307
307
  }
308
308
  };
309
309
 
310
+ pathRequiresAccessToken = path => {
311
+ return (
312
+ !path.includes('/api/v1/auth/login') &&
313
+ !path.includes('/api/v1/auth/register')
314
+ );
315
+ };
316
+
310
317
  proxyToAuthServer = async (req, path) => {
311
- const accessToken = req.cookies['x-access-token'];
312
- if (!accessToken) {
313
- throw new Error('No access token provided');
318
+ if (this.pathRequiresAccessToken(path)) {
319
+ const accessToken = req.cookies['x-access-token'];
320
+ if (!accessToken) {
321
+ throw new Error('No access token provided');
322
+ }
314
323
  }
315
324
 
316
325
  const formattedAuthUrl = formatRedirectUrl(this.options.authUrl);