Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

Add Synology OIDC as login option based upon Authelia settings successful login

Cory Claflinbe532d54555f
diff --git a/.env.sample b/.env.sample
index bd3abcb0..1eb8f2f2 100644
--- a/.env.sample
+++ b/.env.sample
@@ -399,6 +399,13 @@ STRAVA_CUSTOM_NAME=
STRAVA_CLIENT_ID=
STRAVA_CLIENT_SECRET=
+# Synology
+NEXT_PUBLIC_SYNOLOGY_ENABLED=
+SYNOLOGY_CUSTOM_NAME=
+SYNOLOGY_CLIENT_ID=
+SYNOLOGY_CLIENT_SECRET=
+SYNOLOGY_WELLKNOWN_URL=
+
# Todoist
NEXT_PUBLIC_TODOIST_ENABLED=
TODOIST_CUSTOM_NAME=
diff --git a/apps/web/pages/api/v1/auth/[...nextauth].ts b/apps/web/pages/api/v1/auth/[...nextauth].ts
index a8572628..21286858 100644
--- a/apps/web/pages/api/v1/auth/[...nextauth].ts
+++ b/apps/web/pages/api/v1/auth/[...nextauth].ts
@@ -1068,6 +1068,35 @@ if (process.env.NEXT_PUBLIC_STRAVA_ENABLED === "true") {
};
}
+// Synology
+if (process.env.NEXT_PUBLIC_SYNOLOGY_ENABLED === "true") {
+ providers.push({
+ id: "synology",
+ name: "Synology",
+ type: "oauth",
+ clientId: process.env.SYNOLOGY_CLIENT_ID!,
+ clientSecret: process.env.SYNOLOGY_CLIENT_SECRET!,
+ wellKnown: process.env.SYNOLOGY_WELLKNOWN_URL!,
+ authorization: { params: { scope: "openid email profile" } },
+ idToken: true,
+ checks: ["pkce", "state"],
+ profile(profile) {
+ return {
+ id: profile.sub,
+ name: profile.name,
+ email: profile.email,
+ username: profile.preferred_username,
+ };
+ },
+ });
+
+ const _linkAccount = adapter.linkAccount;
+ adapter.linkAccount = (account) => {
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
+ return _linkAccount ? _linkAccount(data) : undefined;
+ };
+}
+
// Todoist
if (process.env.NEXT_PUBLIC_TODOIST_ENABLED === "true") {
providers.push(
diff --git a/apps/web/pages/api/v1/logins/index.ts b/apps/web/pages/api/v1/logins/index.ts
index 8a98210e..bbd3e08d 100644
--- a/apps/web/pages/api/v1/logins/index.ts
+++ b/apps/web/pages/api/v1/logins/index.ts
@@ -335,6 +335,13 @@ export function getLogins() {
name: process.env.STRAVA_CUSTOM_NAME ?? "Strava",
});
}
+ // Synology
+ if (process.env.NEXT_PUBLIC_SYNOLOGY_ENABLED === "true") {
+ buttonAuths.push({
+ method: "synology",
+ name: process.env.SYNOLOGY_CUSTOM_NAME ?? "Synology",
+ });
+ }
// Todoist
if (process.env.NEXT_PUBLIC_TODOIST_ENABLED === "true") {
buttonAuths.push({