Skip to content

fix(web): name the Google and GitHub login flags for what they do - #1556

Open
rajarshidattapy wants to merge 3 commits into
supermemoryai:mainfrom
rajarshidattapy:fix/social-auth-flag-naming
Open

fix(web): name the Google and GitHub login flags for what they do#1556
rajarshidattapy wants to merge 3 commits into
supermemoryai:mainfrom
rajarshidattapy:fix/social-auth-flag-naming

Conversation

@rajarshidattapy

Copy link
Copy Markdown
Contributor

Fixes #1543.

Why?

NEXT_PUBLIC_GOOGLE_AUTH_ENABLED and NEXT_PUBLIC_GITHUB_AUTH_ENABLED were read negated:

process.env.NEXT_PUBLIC_HOST_ID === "supermemory" ||
!process.env.NEXT_PUBLIC_GOOGLE_AUTH_ENABLED ? (...)

So a self-hoster who read the variable name and set NEXT_PUBLIC_GOOGLE_AUTH_ENABLED=true got the opposite of what they asked for: the Google button disappeared. To show it you had to leave the *_ENABLED variable unset.

Neither variable appeared in .env.example or anywhere else in the repo, so nothing contradicted the name. The AgentID flag added in #1467 reads correctly (opt-in), which made the same *_AUTH_ENABLED suffix mean opt-in for one provider and opt-out for two others on the same screen.

What?

Rename both to *_AUTH_DISABLED. The negation stays, so the gate now reads as it behaves — show on cloud, or when not disabled:

process.env.NEXT_PUBLIC_HOST_ID === "supermemory" ||
!process.env.NEXT_PUBLIC_GOOGLE_AUTH_DISABLED ? (...)

Plus all three social flags documented in .env.example, including the fact that AgentID is opt-in while these two are opt-out.

No deployment changes behaviour. Google and GitHub stay on by default when self-hosting, exactly as today; cloud is unaffected either way.

On the alternative fix

The issue offered two resolutions, and I deliberately took the conservative one.

Flipping the logic instead (!XX) would also make the name truthful, but it changes the self-hosted default from shown to hidden — every existing self-hoster with Google OAuth configured and the variable unset (the only way to have it working today) would silently lose the button on upgrade, for a variable they've never heard of because it isn't documented.

If you'd rather have opt-in semantics for consistency with AgentID, that's a one-line change on top of this and I'm happy to push it — but it's a product decision about your self-hosting contract, and it wants a release note rather than a quiet rename.

Testing

Behaviour is unchanged by construction, so there is nothing new to assert — the truth table is identical, only the identifier differs:

HOST_ID flag before after
supermemory anything shown shown
self-hosted unset shown shown
self-hosted set hidden hidden

No remaining references to the old names (rg 'GOOGLE_AUTH_ENABLED|GITHUB_AUTH_ENABLED' is empty). tsc is unaffected — process.env.X is string | undefined under either name.

NEXT_PUBLIC_GOOGLE_AUTH_ENABLED and NEXT_PUBLIC_GITHUB_AUTH_ENABLED were
read negated, so setting either one to "true" hid the button it appeared
to enable. To show the buttons you had to leave the *_ENABLED variable
unset. Neither was in .env.example, so nothing contradicted the name.

Rename both to *_AUTH_DISABLED. The negation stays, so the gate now reads
as it behaves -- "show on cloud, or when not disabled" -- and no
deployment changes behaviour: Google and GitHub stay on by default when
self-hosting, exactly as before.

Document all three social flags in .env.example, including that AgentID
is opt-in while these two are opt-out.
Comment thread apps/web/app/(auth)/login/page.tsx Outdated
) : null}
{process.env.NEXT_PUBLIC_HOST_ID === "supermemory" ||
!process.env.NEXT_PUBLIC_GITHUB_AUTH_ENABLED ? (
!process.env.NEXT_PUBLIC_GITHUB_AUTH_DISABLED ? (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment variable boolean handling bug. Setting NEXT_PUBLIC_GITHUB_AUTH_DISABLED=false will hide the button instead of showing it, because environment variables are strings and !"false" evaluates to false.

Fix by checking for explicit string values:

process.env.NEXT_PUBLIC_HOST_ID === "supermemory" ||
process.env.NEXT_PUBLIC_GITHUB_AUTH_DISABLED !== "true"

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

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.

NEXT_PUBLIC_GOOGLE_AUTH_ENABLED / NEXT_PUBLIC_GITHUB_AUTH_ENABLED are inverted — setting them *hides* the button

1 participant