Skip to content

feat(auth): AgentID sign-in button on the web login page - #1467

Merged
graphite-app[bot] merged 1 commit into
mainfrom
agentid/login-button
Aug 16, 2026
Merged

feat(auth): AgentID sign-in button on the web login page#1467
graphite-app[bot] merged 1 commit into
mainfrom
agentid/login-button

Conversation

@Dhravya

@Dhravya Dhravya commented Aug 14, 2026

Copy link
Copy Markdown
Member

What?

Adds a "Continue with AgentID" button to the web app's login page, matching the existing Google/GitHub buttons (same ExternalAuthButton pattern, PostHog login_attempt capture, last-used badge).

  • packages/lib/auth.ts: adds the genericOAuthClient plugin — generic OAuth providers sign in via signIn.oauth2({ providerId }), not signIn.social.
  • apps/web/app/(auth)/login/page.tsx: the button, gated the same way as the other social buttons — always shown on cloud (NEXT_PUBLIC_HOST_ID === "supermemory"), opt-in elsewhere via NEXT_PUBLIC_AGENTID_AUTH_ENABLED (added to .env.example).

Why?

Companion to supermemoryai/mono#2908, which registers an agentid generic OAuth provider (OIDC against auth.agentid.com) on the API so agents can authenticate with their AgentID identity. The consumer app talks to the same better-auth server, so it gets the same sign-in option. mono#2916 additionally auto-invites the agent's verified human owner to the agent's workspace.

Requires mono#2908 to be deployed for the button to work; until then the API rejects the unknown provider and the page shows its normal error state.

🤖 Generated with Claude Code


Note

Medium Risk
Touches authentication entry points and OAuth client configuration; risk is moderate because it extends login surface area but follows existing social sign-in patterns and is feature-flagged.

Overview
Adds Continue with AgentID on the web login page, using the same ExternalAuthButton flow as Google/GitHub (PostHog login_attempt, last-used badge, loading/error handling).

The button calls signIn.oauth2({ providerId: "agentid" }) instead of signIn.social, enabled by registering genericOAuthClient on the shared better-auth client in packages/lib/auth.ts.

Visibility matches other social providers: shown on cloud when NEXT_PUBLIC_HOST_ID === "supermemory", or elsewhere when NEXT_PUBLIC_AGENTID_AUTH_ENABLED is set (documented in .env.example). Depends on the API registering the agentid generic OAuth provider.

Reviewed by Cursor Bugbot for commit 90a3278. Bugbot is set up for automated code reviews on this repo. Configure here.

@claude

claude Bot commented Aug 14, 2026

Copy link
Copy Markdown

Claude finished @Dhravya's task in 1m 35s —— View job


Review Complete

  • Get current PR diff and review changes
  • Verify previously reported issues are fixed (env.example formatting, truthiness check)
  • Check for any other bugs or security issues
  • Submit review summary

Overview: Adds an AgentID OAuth sign-in button to the login page, following the existing pattern for Google/GitHub buttons.

Issues found: The .env.example formatting issue flagged in earlier reviews has been fixed (commits 90a3278, d110998). The truthiness check flagged by Graphite (NEXT_PUBLIC_AGENTID_AUTH_ENABLED evaluates to true for "false") is a minor consideration but not a blocking issue — the opt-in semantics work correctly for expected use cases (unset = hidden, set = shown). If you want to be more explicit, you could check === "true", but the current behavior is consistent with how many projects handle env var toggles.

The implementation is clean:

  • genericOAuthClient plugin correctly added to better-auth client
  • Button follows the exact same ExternalAuthButton pattern as Google/GitHub
  • PostHog tracking, error handling, and "last used" badge all included
  • Visibility logic matches the PR description (always on cloud, opt-in elsewhere)

Score: 9/10

Minor polish opportunity on the truthiness check, but the code is correct and ready to ship.

Comment thread apps/web/.env.example Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp 5d2b585 Aug 16 2026, 11:22 PM

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overview: Adds an AgentID OAuth sign-in button to the login page, following the existing pattern for Google/GitHub buttons.

Issues found:

  • .env.example has a formatting bug where the comment is on the same line as XAI_API_KEY=, making the comment the variable's value.

The login page implementation is clean — it correctly uses signIn.oauth2() for the generic OAuth provider, has proper error handling, and follows the existing button patterns. The genericOAuthClient plugin addition in auth.ts is straightforward.

Score: 9/10

Minor formatting fix needed in the env example file, otherwise this is ready to ship.

Comment thread apps/web/.env.example Outdated
Comment thread apps/web/.env.example Outdated
Comment on lines +594 to +595
{process.env.NEXT_PUBLIC_HOST_ID === "supermemory" ||
process.env.NEXT_PUBLIC_AGENTID_AUTH_ENABLED ? (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The truthiness check for NEXT_PUBLIC_AGENTID_AUTH_ENABLED will evaluate to true for any non-empty string, including "false", "0", or "no". This means setting NEXT_PUBLIC_AGENTID_AUTH_ENABLED=false will still show the AgentID button.

Fix:

{process.env.NEXT_PUBLIC_HOST_ID === "supermemory" ||
process.env.NEXT_PUBLIC_AGENTID_AUTH_ENABLED === "true" ? (
Suggested change
{process.env.NEXT_PUBLIC_HOST_ID === "supermemory" ||
process.env.NEXT_PUBLIC_AGENTID_AUTH_ENABLED ? (
{process.env.NEXT_PUBLIC_HOST_ID === "supermemory" ||
process.env.NEXT_PUBLIC_AGENTID_AUTH_ENABLED === "true" ? (

Spotted by Graphite

Fix in Graphite


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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app 5d2b585 Commit Preview URL

Branch Preview URL
Aug 16 2026, 11:23 PM

@graphite-app

graphite-app Bot commented Aug 16, 2026

Copy link
Copy Markdown

Merge activity

## What?

Adds a "Continue with AgentID" button to the web app's login page, matching the existing Google/GitHub buttons (same `ExternalAuthButton` pattern, PostHog `login_attempt` capture, last-used badge).

- `packages/lib/auth.ts`: adds the `genericOAuthClient` plugin — generic OAuth providers sign in via `signIn.oauth2({ providerId })`, not `signIn.social`.
- `apps/web/app/(auth)/login/page.tsx`: the button, gated the same way as the other social buttons — always shown on cloud (`NEXT_PUBLIC_HOST_ID === "supermemory"`), opt-in elsewhere via `NEXT_PUBLIC_AGENTID_AUTH_ENABLED` (added to `.env.example`).

## Why?

Companion to supermemoryai/mono#2908, which registers an `agentid` generic OAuth provider (OIDC against auth.agentid.com) on the API so agents can authenticate with their AgentID identity. The consumer app talks to the same better-auth server, so it gets the same sign-in option. mono#2916 additionally auto-invites the agent's verified human owner to the agent's workspace.

Requires mono#2908 to be deployed for the button to work; until then the API rejects the unknown provider and the page shows its normal error state.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches authentication entry points and OAuth client configuration; risk is moderate because it extends login surface area but follows existing social sign-in patterns and is feature-flagged.
>
> **Overview**
> Adds **Continue with AgentID** on the web login page, using the same `ExternalAuthButton` flow as Google/GitHub (PostHog `login_attempt`, last-used badge, loading/error handling).
>
> The button calls **`signIn.oauth2({ providerId: "agentid" })`** instead of `signIn.social`, enabled by registering **`genericOAuthClient`** on the shared better-auth client in `packages/lib/auth.ts`.
>
> Visibility matches other social providers: shown on cloud when `NEXT_PUBLIC_HOST_ID === "supermemory"`, or elsewhere when **`NEXT_PUBLIC_AGENTID_AUTH_ENABLED`** is set (documented in `.env.example`). Depends on the API registering the `agentid` generic OAuth provider.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 90a3278. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@graphite-app
graphite-app Bot force-pushed the agentid/login-button branch from 90a3278 to 5d2b585 Compare August 16, 2026 23:20
@graphite-app
graphite-app Bot merged commit 5d2b585 into main Aug 16, 2026
6 of 8 checks passed
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.

2 participants