Skip to content

feat: Allow multiple tokens per user - #115

Merged
Pijukatel merged 2 commits into
masterfrom
claude/awesome-shannon-kq91rt
Oct 30, 2026
Merged

Pijukatel merged 2 commits into
masterfrom
claude/awesome-shannon-kq91rt

Conversation

@Pijukatel

@Pijukatel Pijukatel commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
  • A new token that resolves to an account the runtime already knows joins that user instead of replacing its record.
  • The user's earlier tokens keep resolving, so a run container or a restart does not lose the account after the CLI's OAuth login rotates its token.
  • token stays the latest one for new runs, schedules and standby links; the last 100 tokens are kept.
  • The upstream fallback still relays exactly the token the caller sent, never the user's latest one.

A token that resolves to an account the runtime already knows joins
that user instead of replacing its record, so a run container or a
restart still finds the account after the CLI's OAuth login rotates
its token.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ocuAJkcWwzKNChWU8WgKU
@Pijukatel
Pijukatel marked this pull request as ready for review October 29, 2026 14:05
@Pijukatel Pijukatel changed the title feat: keep every token a user was seen with feat: Allow multiple tokens per user Oct 29, 2026
@apify-service-account

Copy link
Copy Markdown
Contributor

Platform parity:

  • When the upstream fallback relays a request made with one of a user's earlier tokens, it sends the user's latest-seen token instead (req.user.token is now the shared record's newest token). So a request with a valid personal token can fail closed because the latest token was an expired OAuth one, and a request with an expired or scoped token can succeed with another token's rights. The platform authenticates, scopes and expires each request by the exact token it receives. api.md says the opposite ("always the exact bearer token the caller themselves sent") — users.ts#L58-L74 · api-fallback.ts#L189 · api_authentication.middleware.ts#L82-L114

Reviewed commit: 01e8369

With several tokens per user, the upstream fallback must still forward
exactly the bearer token the request carried, as api.md promises.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ocuAJkcWwzKNChWU8WgKU

Copy link
Copy Markdown
Collaborator Author

Fixed in 1083a2a: auth() now keeps the presented token on the request, and the upstream fallback relays that one instead of req.user.token. A new test covers a user with two tokens calling with the earlier one.


Generated by Claude Code

@apify-service-account

Copy link
Copy Markdown
Contributor

Platform parity: Aligned.

Reviewed commit: 1083a2a

@Pijukatel
Pijukatel merged commit 9e3da43 into master Oct 30, 2026
42 checks passed
@Pijukatel
Pijukatel deleted the claude/awesome-shannon-kq91rt branch October 30, 2026 07:25
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.

3 participants