Integrate new server authentication to client
Changes:
- Use server authentication REST API
- Log in automatically after registration
- Store token in localStorage
- Give feedback to user if registration or login fails
GitLab: #75
Change-Id: Ib90e5b911621567c6825af5e275920d703cdfe88
diff --git a/server/package.json b/server/package.json
index b11c92d..bfcca37 100644
--- a/server/package.json
+++ b/server/package.json
@@ -27,6 +27,7 @@
},
"dependencies": {
"argon2": "^0.29.1",
+ "cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"express-async-handler": "^1.2.0",
diff --git a/server/src/app.ts b/server/src/app.ts
index 634256a..4c30a6c 100644
--- a/server/src/app.ts
+++ b/server/src/app.ts
@@ -15,6 +15,7 @@
* License along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
+import cors from 'cors';
import express, { json, NextFunction, Request, Response } from 'express';
import helmet from 'helmet';
import { HttpStatusCode } from 'jami-web-common';
@@ -33,6 +34,7 @@
// Setup middleware
app.use(helmet());
+ app.use(cors());
app.use(json());
// Setup routing