Skip to content

Build your personal knowledge base with Trilium Notes

Simplified .env

chesspro1355b0f0e3f439
diff --git a/example.env b/example.env
index cec43d3b49..48c81fb7cb 100644
--- a/example.env
+++ b/example.env
@@ -1,9 +1,7 @@
-OAUTH_ENABLED="false"
+SSO_ENABLED="false"
BASE_URL="http://localhost:8080"
CLIENT_ID="1234"
-ISSUER_BASE_URL="https://example.com/xyz/.well-known/openid-configuration"
SECRET="I-Like-Trilium-Notes"
-AUTH_0_LOGOUT="false"
TOTP_ENABLED="false"
TOTP_SECRET="Trilium-Notes-is-the-best"
\ No newline at end of file
diff --git a/src/public/app/widgets/type_widgets/options/multi_factor_authentication.js b/src/public/app/widgets/type_widgets/options/multi_factor_authentication.js
index 8010841d97..ae62bdf2fd 100644
--- a/src/public/app/widgets/type_widgets/options/multi_factor_authentication.js
+++ b/src/public/app/widgets/type_widgets/options/multi_factor_authentication.js
@@ -175,7 +175,7 @@ export default class MultiFactorAuthenticationOptions extends OptionsWidget {
this.$UserAccountEmail.text(result.email);
}else
this.$envEnabledOAuth.text(
- "set OAUTH_ENABLED as environment variable to 'true' to enable (Requires restart)"
+ "set SSO_ENABLED as environment variable to 'true' to enable (Requires restart)"
);
});
diff --git a/src/services/open_id.ts b/src/services/open_id.ts
index fb17744c91..627636574e 100644
--- a/src/services/open_id.ts
+++ b/src/services/open_id.ts
@@ -35,10 +35,10 @@ function clearSavedUser() {
}
function checkOpenIDRequirements() {
- if (process.env.OAUTH_ENABLED === undefined) {
+ if (process.env.SSO_ENABLED === undefined) {
return false;
}
- if (process.env.OAUTH_ENABLED.toLocaleLowerCase() !== "true") {
+ if (process.env.SSO_ENABLED.toLocaleLowerCase() !== "true") {
return false;
}
@@ -48,15 +48,9 @@ function checkOpenIDRequirements() {
if (process.env.CLIENT_ID === undefined) {
throw new OpenIDError("CLIENT_ID is undefined in .env!");
}
- if (process.env.ISSUER_BASE_URL === undefined) {
- throw new OpenIDError("ISSUER_BASE_URL is undefined in .env!");
- }
if (process.env.SECRET === undefined) {
throw new OpenIDError("SECRET is undefined in .env!");
}
- if (process.env.AUTH_0_LOGOUT === undefined) {
- throw new OpenIDError("AUTH_0_LOGOUT is undefined in .env!");
- }
return true;
}
@@ -100,12 +94,6 @@ function isTokenValid(req: Request, res: Response, next: NextFunction) {
}
}
-function checkAuth0Logout() {
- if (process.env.AUTH_0_LOGOUT === undefined) return false;
- if (process.env.AUTH_0_LOGOUT.toLocaleLowerCase() === "true") return true;
- return false;
-}
-
function generateOAuthConfig() {
const authRoutes = {
callback: "/callback",
@@ -119,10 +107,10 @@ function generateOAuthConfig() {
const authConfig = {
authRequired: true,
- auth0Logout: checkAuth0Logout(),
+ auth0Logout: false,
baseURL: process.env.BASE_URL,
clientID: process.env.CLIENT_ID,
- issuerBaseURL: process.env.ISSUER_BASE_URL,
+ issuerBaseURL: "https://accounts.google.com/.well-known/openid-configuration",
secret: process.env.SECRET,
clientSecret: process.env.SECRET,
authorizationParams: {