Changeset 834bcc3 in Klonkt for src/config/google.js
- Timestamp:
- 06/23/2026 06:14:27 PM (3 months ago)
- Branches:
- main
- Children:
- d774679
- Parents:
- bb42dfb
- File:
-
- 1 edited
-
src/config/google.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/config/google.js
rbb42dfb r834bcc3 1 // Google OAuth2 voor LUISTERAARS (reageren). Per-instance: de self-hoster zet2 // z'n EIGEN Google-client. Zo hangt elke site aan z'n eigen Google Cloud project3 // — geen centrale afhankelijkheid, geen gedeelde aansprakelijkheid.1 // Google OAuth2 for LISTENERS (commenting). Per-instance: each self-hoster sets 2 // their OWN Google client. This way every site is tied to its own Google Cloud 3 // project — no central dependency, no shared liability. 4 4 // 5 // Config -bron (in deze volgorde): app_settings (ingesteld via Beheer → Instellingen),6 // anders de env-vars. Niet ingesteld → geen "Login met Google"-knop; de rest van7 // de site werkt door. Google-login geeft NOOIT beheerrechten.5 // Config source (in this order): app_settings (set via Admin → Settings), 6 // otherwise env vars. Not configured → no "Login with Google" button; the rest 7 // of the site keeps working. Google login NEVER grants admin rights. 8 8 // 9 // De redirect-URI wordt afgeleid vanPUBLIC_BASE_URL (<base>/auth/google/callback),10 // o f expliciet via GOOGLE_REDIRECT_URI. Die exacte URL moet in Google Cloud staan.9 // The redirect URI is derived from PUBLIC_BASE_URL (<base>/auth/google/callback), 10 // or explicitly via GOOGLE_REDIRECT_URI. That exact URL must be listed in Google Cloud. 11 11 12 12 import { getSetting } from '../services/SettingsService.js'; … … 16 16 const USERINFO_URL = 'https://openidconnect.googleapis.com/v1/userinfo'; 17 17 18 // Dynamisch lezen (UI-wijziging werkt zonder herstart). app_settings wint, env = fallback.18 // Read dynamically (UI changes take effect without a restart). app_settings wins, env = fallback. 19 19 function clientId() { 20 20 return getSetting('google_client_id', '') || process.env.GOOGLE_CLIENT_ID || ''; … … 29 29 } 30 30 31 export function currentClientId() { return clientId(); } // n iet-geheim, voor het formulier31 export function currentClientId() { return clientId(); } // not secret, used for the settings form 32 32 export function clientSecretSet() { return !!clientSecret(); } 33 33 export function googleConfigured() { … … 61 61 body, 62 62 }); 63 if (!r.ok) throw new Error(`Google token -exchange faalde: ${r.status}`);63 if (!r.ok) throw new Error(`Google token exchange failed: ${r.status}`); 64 64 return r.json(); // { access_token, id_token, ... } 65 65 } … … 68 68 export async function fetchUserinfo(accessToken) { 69 69 const r = await fetch(USERINFO_URL, { headers: { Authorization: `Bearer ${accessToken}` } }); 70 if (!r.ok) throw new Error(`Google userinfo fa alde: ${r.status}`);70 if (!r.ok) throw new Error(`Google userinfo failed: ${r.status}`); 71 71 return r.json(); 72 72 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)