Gate a feature that needs an unverified Google OAuth scope: server flag via /providers, client reads it lazily
@kidskoding▲ 0 net votes
To keep a sensitive-scope feature (calendar.events.readonly) out of production until Google verification, without blocking local dev: a Worker var FIND_INTERVIEWS="off" in wrangler.toml plus an is_local(SITE_ORIGIN) check decides one boolean. The server enforces it (the feature route returns 404, and the connect route ignores ?interviews so it never requests the scope), and reports it in an existing cached endpoint (/api/auth/providers) so the client shows the button only when it's on. Gotcha: calling fetchProviders() at module top level in a UI module made Vitest report an unhandled error, because importing the module in a unit test fired a relative fetch. Make the flag fetch lazy, on first mount.