Adding Microsoft auth
This commit is contained in:
@@ -5,5 +5,6 @@ FRONTEND_URL=http://localhost:3000
|
|||||||
BACKEND_URL=http://localhost:5000
|
BACKEND_URL=http://localhost:5000
|
||||||
VITE_API_BASE_URL=http://localhost:5000/api
|
VITE_API_BASE_URL=http://localhost:5000/api
|
||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
|
TRUST_PROXY=
|
||||||
ADMIN_EMAILS=corey@blaishome.online
|
ADMIN_EMAILS=corey@blaishome.online
|
||||||
RESCUE_STATUS_NOTIFICATION_EMAIL=appadmin@flockpal.app
|
RESCUE_STATUS_NOTIFICATION_EMAIL=appadmin@flockpal.app
|
||||||
|
|||||||
@@ -89,6 +89,11 @@ const port = Number(process.env.PORT ?? 5000);
|
|||||||
const frontendBaseUrl = process.env.FRONTEND_URL ?? 'http://localhost:3000';
|
const frontendBaseUrl = process.env.FRONTEND_URL ?? 'http://localhost:3000';
|
||||||
const backendBaseUrl = process.env.BACKEND_URL ?? `http://localhost:${port}`;
|
const backendBaseUrl = process.env.BACKEND_URL ?? `http://localhost:${port}`;
|
||||||
const sessionDays = 30;
|
const sessionDays = 30;
|
||||||
|
const trustProxy = process.env.TRUST_PROXY?.trim() ?? '';
|
||||||
|
|
||||||
|
if (trustProxy) {
|
||||||
|
app.set('trust proxy', trustProxy === 'true' ? true : Number(trustProxy) || trustProxy);
|
||||||
|
}
|
||||||
|
|
||||||
const defaultAllowedOrigins = ['http://localhost:3000', 'http://127.0.0.1:3000', 'http://localhost:5173', 'http://127.0.0.1:5173'];
|
const defaultAllowedOrigins = ['http://localhost:3000', 'http://127.0.0.1:3000', 'http://localhost:5173', 'http://127.0.0.1:5173'];
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
PORT: 5000
|
PORT: 5000
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
|
TRUST_PROXY: ${TRUST_PROXY:-1}
|
||||||
POSTGRES_HOST: postgres
|
POSTGRES_HOST: postgres
|
||||||
POSTGRES_PORT: 5432
|
POSTGRES_PORT: 5432
|
||||||
POSTGRES_DB: ${POSTGRES_DB:-flockpal}
|
POSTGRES_DB: ${POSTGRES_DB:-flockpal}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
PORT: 5000
|
PORT: 5000
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
|
TRUST_PROXY: ${TRUST_PROXY:-}
|
||||||
POSTGRES_HOST: postgres
|
POSTGRES_HOST: postgres
|
||||||
POSTGRES_PORT: 5432
|
POSTGRES_PORT: 5432
|
||||||
POSTGRES_DB: ${POSTGRES_DB:-flockpal}
|
POSTGRES_DB: ${POSTGRES_DB:-flockpal}
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ const clearSessionToken = () => {
|
|||||||
const readStoredSessionToken = () => window.localStorage.getItem(sessionTokenStorageKey) ?? '';
|
const readStoredSessionToken = () => window.localStorage.getItem(sessionTokenStorageKey) ?? '';
|
||||||
|
|
||||||
const oauthStartUrl = (providerKey: AuthProvider['providerKey']) => {
|
const oauthStartUrl = (providerKey: AuthProvider['providerKey']) => {
|
||||||
const url = new URL(`${apiBaseUrl}/auth/oauth/${providerKey}/start`);
|
const url = new URL(`${apiBaseUrl}/auth/oauth/${providerKey}/start`, window.location.origin);
|
||||||
url.searchParams.set('redirectTo', window.location.href);
|
url.searchParams.set('redirectTo', window.location.href);
|
||||||
return url.toString();
|
return url.toString();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user