Skip to content

feat: add OAuth login profiles#91

Merged
Mukil Loganathan (langchain-infra) merged 7 commits into
mainfrom
mukil/oauth-login-split
Apr 30, 2026
Merged

feat: add OAuth login profiles#91
Mukil Loganathan (langchain-infra) merged 7 commits into
mainfrom
mukil/oauth-login-split

Conversation

@langchain-infra
Copy link
Copy Markdown
Contributor

Follow-up to #87, which was merged into mukil/profile-management. This PR retargets the OAuth login layer directly onto main.

Summary:

  • add langsmith login with OAuth device-code flow
  • store OAuth access/refresh tokens under the selected profile
  • refresh profile OAuth tokens when they are missing or near expiry
  • use OAuth access tokens as Authorization bearer headers for CLI and raw API commands

OAuth profile format:

{
  "current_profile": "local",
  "profiles": {
    "local": {
      "api_url": "http://localhost:1980",
      "workspace_id": "00000000-0000-0000-0000-000000000000",
      "oauth": {
        "access_token": "REDACTED_OAUTH_ACCESS_TOKEN",
        "refresh_token": "REDACTED_OAUTH_REFRESH_TOKEN",
        "expires_at": "2026-04-29T18:00:00Z"
      }
    }
  }
}

Example commands:

langsmith login --api-url http://127.0.0.1:1980 --profile local --workspace-id 593d649c-2548-4069-af4b-c8867e279ee6 --no-browser
{
  "oauth_expires_at": "2026-04-30T01:08:51Z",
  "profile": "local",
  "status": "logged_in",
  "workspace_id": "593d649c-2548-4069-af4b-c8867e279ee6"
}
langsmith --profile dev --format pretty profile list
  ACTIVE    NAME     API URL                              WORKSPACE ID                            AUTH     EXPIRES AT
---------+-------+-------------------------------------+--------------------------------------+-------+----------------------
  *         dev      https://dev.api.smith.langchain.com    d6684905-655c-429b-bd14-ba302d94c03b    oauth    2026-04-30T02:50:40Z
            local    http://127.0.0.1:1980                  593d649c-2548-4069-af4b-c8867e279ee6    oauth    2026-04-30T01:08:51Z
langsmith --profile dev api GET "/api/v1/sessions?limit=1" --include
HTTP/2.0 200 OK
X-Pagination-Total: 2
Content-Type: application/json

[
  {
    "name": "integ-test-zjgj-96959",
    "id": "8d565e27-6157-44ad-a694-9ab6fdc87e82",
    "tenant_id": "d6684905-655c-429b-bd14-ba302d94c03b"
  }
]

Verification:

  • go test ./internal/cmd -run 'TestProfileDisplayTrimsEnvProfile|TestWorkspace' -count=1 on main
  • go test ./... -count=1 on mukil/oauth-login-split

@langchain-infra Mukil Loganathan (langchain-infra) merged commit e24c815 into main Apr 30, 2026
11 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