Skip to content

fix(web): stop NEXT_PUBLIC_*_AUTH_ENABLED from hiding the provider it names - #1457

Open
Chirag6722 wants to merge 1 commit into
supermemoryai:mainfrom
Chirag6722:fix/social-auth-enabled-flags
Open

fix(web): stop NEXT_PUBLIC_*_AUTH_ENABLED from hiding the provider it names#1457
Chirag6722 wants to merge 1 commit into
supermemoryai:mainfrom
Chirag6722:fix/social-auth-enabled-flags

Conversation

@Chirag6722

Copy link
Copy Markdown

Fixes #1278.

The bug

The Google and GitHub buttons on the login page were gated like this:

{process.env.NEXT_PUBLIC_HOST_ID === "supermemory" ||
 !process.env.NEXT_PUBLIC_GOOGLE_AUTH_ENABLED ? ( /* Google button */ )

Because of the !, a self-hosted deployment that set NEXT_PUBLIC_GOOGLE_AUTH_ENABLED=true to turn Google on got the opposite result — the button disappeared. Same for GitHub.

Why not just drop the !

#1278 deliberately stopped short of a patch, because the two readings imply different defaults and the right one is a product call:

  • Drop the ! (opt-in): matches the name, but the buttons vanish for every existing self-hoster who never set the flag. Breaking.
  • Keep current behaviour (opt-out): the default is fine, but the variable is misnamed and setting it to true does the wrong thing.

This PR takes the second reading and makes the implementation honest, so no existing deployment changes behaviour:

flag value before after
unset shown shown (unchanged)
true hidden ← the bug shown
false / 0 shown hidden (new — a real off-switch)

Only the previously broken case changes. The flag now never hides the provider it names, and self-hosters get an actual way to turn a provider off, which the old logic couldn't express either.

If you'd rather have true opt-in semantics (unset = hidden), say so and I'll flip it — it's a two-line change to isSocialProviderEnabled, though it would want a changelog note for self-hosters.

Also

Both variables are now in apps/web/.env.example. #1278 notes the two gating lines were their only references anywhere in the repo — no example entry, no docs.

Verification

… names

The Google and GitHub buttons on the login page were gated on
`!process.env.NEXT_PUBLIC_<PROVIDER>_AUTH_ENABLED`, so a self-hosted
deployment that set `NEXT_PUBLIC_GOOGLE_AUTH_ENABLED=true` to turn Google
on got the opposite: the button disappeared.

Rather than dropping the `!` -- which would hide the buttons for every
existing self-hoster who never set the flag -- treat the variables as the
opt-out switch their current default implies. Unset still shows the
provider, any truthy value shows it, and `false`/`0` now genuinely hides
it. Only the previously broken case changes behaviour.

Both variables are also documented in apps/web/.env.example, where they
had no entry.

Fixes supermemoryai#1278
@Chirag6722

Copy link
Copy Markdown
Author

@Dhravya @MaheshtheDev — first contribution here, so both Actions runs are parked at action_required and need a maintainer to approve them before anything runs.

In the meantime I ran CI's exact steps locally against this branch:

  • bunx biome ci --changed --since=main --no-errors-on-unmatched — passes
  • bunx turbo run check-types --filter='@supermemory/ai-sdk' --filter='@supermemory/memory-graph' — 2 successful, 2 total
  • bun.lock is untouched, so bun install --frozen-lockfile is unaffected

The one thing worth your call is the default, which is why #1278 was filed as an issue rather than a PR: I went with opt-out semantics so no existing self-hosted deployment changes behaviour (unset still shows the provider, true now shows it instead of hiding it, false/0 hides it). If you'd rather have true opt-in — unset means hidden — it's a two-line change to isSocialProviderEnabled and I'll push it right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login page: NEXT_PUBLIC_*_AUTH_ENABLED flags act inverted (setting them hides the OAuth buttons)

1 participant