diff --git a/backend/src/controllers/auth.controller.ts b/backend/src/controllers/auth.controller.ts index 9e5166c..1678bc3 100644 --- a/backend/src/controllers/auth.controller.ts +++ b/backend/src/controllers/auth.controller.ts @@ -6,7 +6,7 @@ import { LoggerService } from '../services/logger.service.js'; import { ACCESS_TOKEN_COOKIE_NAME, MEET_ACCESS_TOKEN_EXPIRATION, - MEET_API_BASE_PATH_V1, + MEET_INTERNAL_API_BASE_PATH_V1, MEET_REFRESH_TOKEN_EXPIRATION, REFRESH_TOKEN_COOKIE_NAME } from '../environment.js'; @@ -35,7 +35,7 @@ export const login = async (req: Request, res: Response) => { res.cookie( REFRESH_TOKEN_COOKIE_NAME, refreshToken, - getCookieOptions(`${MEET_API_BASE_PATH_V1}/auth`, MEET_REFRESH_TOKEN_EXPIRATION) + getCookieOptions(`${MEET_INTERNAL_API_BASE_PATH_V1}/auth`, MEET_REFRESH_TOKEN_EXPIRATION) ); logger.info(`Login succeeded for user ${username}`); return res.status(200).json({ message: 'Login succeeded' }); @@ -48,7 +48,7 @@ export const login = async (req: Request, res: Response) => { export const logout = (_req: Request, res: Response) => { res.clearCookie(ACCESS_TOKEN_COOKIE_NAME); res.clearCookie(REFRESH_TOKEN_COOKIE_NAME, { - path: `${MEET_API_BASE_PATH_V1}/auth` + path: `${MEET_INTERNAL_API_BASE_PATH_V1}/auth` }); return res.status(200).json({ message: 'Logout successful' }); }; diff --git a/backend/src/server.ts b/backend/src/server.ts index 0252a20..bc1713f 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -9,7 +9,13 @@ import { MEET_API_BASE_PATH_V1, MEET_INTERNAL_API_BASE_PATH_V1 } from './environment.js'; -import { publicApiHtmlFilePath, indexHtmlPath, publicFilesPath, webcomponentBundlePath, internalApiHtmlFilePath } from './utils/path-utils.js'; +import { + publicApiHtmlFilePath, + indexHtmlPath, + publicFilesPath, + webcomponentBundlePath, + internalApiHtmlFilePath +} from './utils/path-utils.js'; import { authRouter, internalRecordingRouter, @@ -41,14 +47,17 @@ const createApp = () => { app.use(express.json()); app.use(cookieParser()); + // Public API routes app.use(`${MEET_API_BASE_PATH_V1}/docs`, (_req: Request, res: Response) => res.sendFile(publicApiHtmlFilePath)); - app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/docs`, (_req: Request, res: Response) => res.sendFile(internalApiHtmlFilePath)); app.use(`${MEET_API_BASE_PATH_V1}/rooms`, /*mediaTypeValidatorMiddleware,*/ roomRouter); app.use(`${MEET_API_BASE_PATH_V1}/recordings`, /*mediaTypeValidatorMiddleware,*/ recordingRouter); - app.use(`${MEET_API_BASE_PATH_V1}/auth`, /*mediaTypeValidatorMiddleware,*/ authRouter); app.use(`${MEET_API_BASE_PATH_V1}/preferences`, /*mediaTypeValidatorMiddleware,*/ preferencesRouter); - // Internal routes + // Internal API routes + app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/docs`, (_req: Request, res: Response) => + res.sendFile(internalApiHtmlFilePath) + ); + app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/auth`, authRouter); app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/rooms`, internalRoomRouter); app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/participants`, internalParticipantsRouter); app.use(`${MEET_INTERNAL_API_BASE_PATH_V1}/recordings`, internalRecordingRouter); diff --git a/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts b/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts index 75a0561..a6a388a 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts @@ -96,19 +96,19 @@ export class HttpService { } login(body: { username: string; password: string }): Promise<{ message: string }> { - return this.postRequest(`${this.API_PATH_PREFIX}/${this.API_V1_VERSION}/auth/login`, body); + return this.postRequest(`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/auth/login`, body); } logout(): Promise<{ message: string }> { - return this.postRequest(`${this.API_PATH_PREFIX}/${this.API_V1_VERSION}/auth/logout`); + return this.postRequest(`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/auth/logout`); } refreshToken(): Promise<{ message: string }> { - return this.postRequest(`${this.API_PATH_PREFIX}/${this.API_V1_VERSION}/auth/refresh`); + return this.postRequest(`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/auth/refresh`); } getProfile(): Promise { - return this.getRequest(`${this.API_PATH_PREFIX}/${this.API_V1_VERSION}/auth/profile`); + return this.getRequest(`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/auth/profile`); } getRecordings(continuationToken?: string): Promise<{ recordings: RecordingInfo[]; continuationToken: string }> {