---
title: "Login with agent: how AI agents sign in safely"
description: "How AI agents sign in to existing accounts and third-party apps without password sharing, using scoped OAuth tokens and brokered agent login."
canonical: "https://agentregistrar.dev/topics/login-with-agent"
last-updated: "2026-11-24"
---

# Login with agent: how AI agents sign in safely

Published: 2026-11-24

> How AI agents sign in to existing accounts and third-party apps without password sharing, using scoped OAuth tokens and brokered agent login.

Signing an AI agent in is a different problem from [creating a new agent account](https://agentregistrar.dev/topics/ai-agent-create-account). When builders look for login with agent or AI agent login, they are usually trying to solve one of two distinct jobs. The first is giving an agent delegated access to an account a human already owns without handing over a password or browser cookie. The second is letting an agent re-authenticate to an account it already created across new sessions, ephemeral containers, or fresh devices -- often called sign in with agent or agent re-login.

Mixing those two jobs leads to fragile workarounds. Scoped OAuth 2.1 handles delegated access into a human's existing account, while brokered re-login through `endpoints.agent_login` in the [Agent Identity Protocol](https://github.com/agentregistrar/spec/blob/v2.3.0/agent-identity-protocol.md) handles ongoing sessions for agent-created accounts. Both keep raw passwords out of prompts and keep the [agent authentication boundary](https://agentregistrar.dev/topics/agent-authentication) explicit.

## Why password managers, browser profiles, and shared cookies fail

The fastest shortcut is pasting a password, exporting a browser profile, or copying a session cookie into an agent's environment. As explained in [why you should not give an AI agent your password manager](https://docs.agentregistrar.dev/faq/should-i-give-my-ai-agent-my-password-manager/), that shortcut breaks down on four operational fronts:

- Unscoped blast radius. A password or browser cookie jar carries every permission the human holds: billing settings, team invites, API key deletion, and unrelated tabs signed in under the same browser profile.
- Zero per-agent audit trail. When a request arrives with a human session cookie or shared login, the service cannot tell whether the human clicked a button or one of three background agents ran a tool call.
- Prompt-injection exposure. Agents read untrusted web pages, issues, and inbound emails. Any cookie, TOTP seed, or password held in the agent's runtime can be read or exfiltrated if a prompt injection redirects the agent's next request.
- Rotation breaks everything else. Rotating one leaked password or revoking a browser session forces the human and every other tool sharing that login to re-authenticate at once.

## Scoped OAuth 2.1 delegation for existing human accounts

When an agent needs to act inside an account a person already owns, the right mechanism is scoped OAuth 2.1 delegation rather than shared credentials. Across Model Context Protocol (MCP) clients and servers, OAuth 2.1 gives each coding tool or agent harness its own token, bound to narrow scopes and revocable without touching the human's password.

Three pieces make MCP OAuth work cleanly across local and remote tools. First, Proof Key for Code Exchange (PKCE) with `S256` binds the authorization code to the client that started the flow, blocking code interception on loopback redirects or shared hosts. Second, Dynamic Client Registration (DCR) and Client ID Metadata Documents (CIMD) let an MCP client present or register its client identity automatically so the human does not copy client secrets by hand.

Third, consent binds a specific agent identity. During Agent Registrar's OAuth consent step at `/oauth/authorize`, the human owner selects an active agent sub-identity or creates a new one and approves the exact requested scopes. The resulting OAuth token is tied to that single agent record rather than granting blanket access across every agent the human runs. If one coding tool misbehaves, revoking its OAuth grant or flipping that agent's kill switch stops its access while leaving other agents and the human's login untouched.

## How brokered agent re-login solves "Sign in with Agent"

OAuth assumes an existing human account at the target app. Once an agent creates its own account through [agentic signup](https://agentregistrar.dev/topics/agentic-signup), a second login problem appears: how does that agent sign back in when its local session expires, when a container restarts, or when the human switches to a new machine? Re-running signup risks creating duplicate accounts or colliding on email addresses.

Agent Identity Protocol `v2.2.0` and `v2.3.0` address this with an optional `endpoints.agent_login` URL in the service's discovery document (`/.well-known/agent-signup.json`). The flow separates initial account creation from ongoing agent re-login without turning the broker into a password vault.

### Short-lived login assertions via identity_login

Agent Registrar's remote MCP server at `https://agentregistrar.dev/mcp` exposes 5 tools, documented in [the MCP tools reference](https://docs.agentregistrar.dev/reference/mcp-tools/). When a service publishes `endpoints.agent_login`, the agent calls `identity_login` instead of `identity_signup`. The broker checks that the human owner and agent are active, fetches discovery, verifies any provider verification credential under the human's trust policy, and mints a fresh, uncached 120-second assertion JWT with `purpose: "login"`.

The tool returns a prepared `POST` request containing that assertion in the `Authorization: Bearer` header. The agent sends the request directly to the provider's `endpoints.agent_login` endpoint; the broker is not in the provider's session traffic.

### Anti-account-takeover resolution and per-service controls

A login endpoint must not let an unverified claim attach to a human user's account by guessing an email address. Under the protocol's anti-account-takeover resolution rules, providers match a `purpose: "login"` assertion against an existing agent-linked account (bound to the verified broker issuer and agent subject) rather than merging blindly onto an existing human account by email alone. Providers also enforce single-use `jti` replay checks so an intercepted login assertion cannot be replayed during its 120-second lifetime.

Human owners keep per-service control over agent re-login in `/trust`, where they can disable re-login for a specific service while keeping other services enabled. When an agent starts a login session for a new context, the broker also sends a first-session security alert email to the human owner so unexpected re-logins are visible immediately.

### Terms re-attestation, handoff, and human step-up

Long-lived agent accounts eventually run into updated terms of service. As covered in [how AI agents accept terms of service](https://agentregistrar.dev/topics/ai-agents-accept-terms-of-service), each acceptance is pinned to a SHA-256 hash and version string. When a provider bumps `terms.version` or changes `terms.url` in discovery, `identity_login` detects the drift and fetches and hashes the new document before minting the login assertion.

By default, the agent re-accepts updated terms autonomously under the human owner's delegation agreement and records a new acceptance entry linked to the prior one, emailing a copy to the human. If the owner prefers explicit review before accepting new terms, they can turn on human approval in `/settings`. When terms drift under that setting, `identity_login` pauses without minting an assertion, emails the owner, and returns an approval URL at `/approvals/[id]` so the human can review the version change before the agent retries.

On the provider response side, the protocol defines structured replies for both automated and gated logins. On success, the provider can return a `handoff` object with the new session token or MCP configuration, which the agent saves locally without forwarding secrets back to the broker. When the provider needs an interactive check -- such as linking an existing human workspace or completing additional verification -- it returns `human_action_required` with a `verification_url` so the agent stops retrying and directs the human to finish the step.

You can exercise this full login, terms-bump, `handoff`, and `human_action_required` sequence end to end in the isolated Demo Network at [agentregistrardemobroker.com](https://agentregistrardemobroker.com) against [the reference provider](https://reference.agentregistrardemorp.com).

## Comparing AI agent login patterns

Each login pattern trades scope, credential custody, and auditability differently depending on whether the account belongs to a human or an agent.

| Approach | Mechanism | Scope & isolation | Credential custody | Terms / session audit trail | Best fit |
| --- | --- | --- | --- | --- | --- |
| Password / cookie sharing | Human pastes password, TOTP secret, or browser cookie into agent runtime. | None; inherits full human account and shared browser session access. | Human credentials live inside agent memory, logs, and disk. | Indistinguishable from human activity; no per-agent session record. | Legacy human-only sites where no API or delegation flow exists. |
| OAuth 2.1 delegation | PKCE + DCR or CIMD consent flow binds scoped token to a specific agent. | Scoped to approved permissions and bound to one agent record. | Client holds OAuth bearer/refresh tokens; password stays with human. | Consent grant and per-agent token issuance logged at authorization server. | Giving an agent controlled access to an existing human account or MCP server. |
| Brokered agent login (`endpoints.agent_login`) | `identity_login` mints a 120-second `purpose: "login"` assertion sent directly to provider. | Audience-locked per service, anti-ATO account resolution, and `/trust` re-login toggle. | Provider issues session via `handoff`; broker stores zero provider keys. | Logs login assertions, first-session alerts, and SHA-256 terms re-acceptances. | Ongoing re-authentication for agent-created accounts across sessions and devices. |

## Honest limits of brokered login

Knowing what the broker does not do is as important as knowing the wire flow. Full protocol boundaries are documented in [Trust and limits](https://docs.agentregistrar.dev/start/trust-and-limits/) and [Credentials and recovery](https://docs.agentregistrar.dev/agents/credentials-and-recovery/):

- No credential custody or recovery. The broker never receives, stores, or proxies provider session tokens or API keys returned in `handoff`. If an agent loses a local secret, the broker cannot recover it; the agent must re-authenticate through `endpoints.agent_login` if the provider supports it, or follow the provider's own recovery flow.
- Kill switch scope. Flipping an agent's kill switch in the Developer Portal stops new `identity_signup` and `identity_login` assertions and cuts off inbox access. Existing provider sessions remain governed by the provider's own token expiry and session revocation controls.
- Email verification, not KYC. The `human.verified` claim proves the human owner verified an email address and signed the delegation agreement. It is not KYC, and providers keep full authority to apply risk scoring, rate limits, or `human_action_required` step-up checks before issuing a session.

## Related topics

- [How AI agents create accounts on websites](https://agentregistrar.dev/topics/ai-agent-create-account)
- [Agent authentication: API keys, OAuth, and tokens](https://agentregistrar.dev/topics/agent-authentication)
- [How do I let agents sign up for my product?](https://agentregistrar.dev/topics/agentic-signup)
- [How do I let an agent sign my terms of service?](https://agentregistrar.dev/topics/ai-agents-accept-terms-of-service)
