Skip to content

Instantly share code, notes, and snippets.

@eonist
Created February 4, 2026 13:22
Show Gist options
  • Select an option

  • Save eonist/442927ea88a4de0a0889b97abed29ba8 to your computer and use it in GitHub Desktop.

Select an option

Save eonist/442927ea88a4de0a0889b97abed29ba8 to your computer and use it in GitHub Desktop.
sign in with claude code

Here is the translation of the Norwegian text to English:


Can I Add "Sign in with Claude Code" to My App?

No, you currently cannot add a "Log in with Claude" button to your app the same way you would with Google or GitHub OAuth. Claude Code is a tool aimed at developer workflows, not an identity platform for third-party apps. claudelog

Key Points About Authentication and Integration

  • No public OAuth for apps: Anthropic currently only allows OAuth login for its own services (like Claude.ai) and select partners like GitHub. claudelog
  • Security restrictions: Anthropic has recently implemented technical barriers to prevent third-party apps from "impersonating" Claude Code to access models with different pricing or limits. reddit
  • Developer integration: You can integrate Claude's intelligence into your app via the Claude API using API keys generated in the Claude Console. code.claude
  • Model Context Protocol (MCP): If your goal is to let users connect their tools to Claude, you should look at the MCP standard. This allows your app to function as a data source for Claude. cio

How Does Apple Xcode Do It Then?

Xcode (and other IDEs like VS Code) differ from regular apps because they have a direct partner agreement with Anthropic and use specially built integrations rather than an open login button.

How It Works in Xcode

  • Native integration: In Xcode 26.3 and newer, Apple has built-in support for Claude directly in the system settings under Intelligence. cio
  • Two login methods: Users can connect in two ways:
    • OAuth login: The user logs in with their existing Claude.ai account via a browser that communicates directly with Xcode's internal authentication service. github
    • API keys: The user can manually paste an API key from their Anthropic Console. code.claude
  • Claude Agent SDK: Xcode uses the Claude Agent SDK, the same framework that powers Claude Code. This gives Claude access to read project files and run tests directly in Xcode. platform.claude
  • Model Context Protocol (MCP): Apple uses MCP to let Claude "see" what's happening in your code in a secure way. cio

What This Means for Your App

Since there isn't a "Log in with Claude" button available for everyone yet, the only way to give your users a similar experience is to ask them to enter their own Anthropic API key in your app's settings, similar to what Xcode allows as an alternative. support.claude


Can I Add Claude Agent SDK to My App?

Yes, you can add the Claude Agent SDK to your app! This is the same framework that powers Claude Code and the Xcode integration, and it's now available to all developers. platform.claude

What Does the SDK Do?

The SDK lets you build "agentic" features without having to code everything from scratch. It handles:

  • File and terminal access: Claude can read/write files and run commands in a controlled environment
  • Tool use: Integration with Model Context Protocol (MCP) to connect to external data cio
  • Conversation history: Automatic handling of context and "loops" where Claude iterates toward a solution

Installation

Python:

pip install claude-agent-sdk

TypeScript:

npm install @anthropic-ai/claude-agent-sdk

Important Limitations

Even though you can use the SDK, Anthropic has strict rules for authentication in third-party apps:

  • Use API keys: You must use your own (or the user's) Anthropic API key. platform.claude
  • No "OAuth shortcuts": You're not allowed to let users log in with their private Claude Pro account in your app to bypass API costs. reddit
  • Claude Code requirement: The SDK often requires that the Claude Code CLI is installed on the machine running the code, as the SDK functions as a layer on top of it. reddit

Does Usage Count Toward the User's Subscription?

Yes, and it depends entirely on how you authenticate the user:

Using the User's Subscription (Pro/Max)

If the user has Claude Code installed locally on their machine and has logged in with their Claude Pro or Max account, your SDK can "borrow" this authentication. support.claude

  • Benefit: Usage is deducted from the user's existing "quota" (5-hour rolling window) instead of you or them paying per token. claudelog
  • How: The SDK automatically checks for credentials from a local Claude Code installation if no API key is set. reddit

Using API Keys (Pay-as-you-go)

If you ask the user to enter an Anthropic API key (from the Claude Console), it works differently:

  • Separate billing: Usage has nothing to do with any Pro subscription. claudelog
  • Cost: The user (or you) is billed per million tokens sent and received. claudelog
Method Where Does the Bill Go? Limits
Through Claude Code User's Pro/Max subscription Shared with Claude.ai (e.g., 5-hour limit) support.claude
API key User's API credits Pay-as-you-go (no time limit) claudelog

Important for Developers

Anthropic does not allow you to build an app that lets users log in with their Claude.ai account directly in your cloud to use their subscription there. For the subscription to apply, the SDK must run locally on the user's machine where they're already authenticated via Claude Code CLI. reddit

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