Skip to content

Accept bearer tokens in TEAMWORK_API_TOKEN - #81

Merged
rafaeljusto merged 1 commit into
masterfrom
bearer-token-auth
Nov 18, 2026
Merged

rafaeljusto merged 1 commit into
masterfrom
bearer-token-auth

Conversation

@rafaeljusto

Copy link
Copy Markdown
Contributor

Summary

TEAMWORK_API_TOKEN now also accepts a bearer token. A value that starts with tkn. goes in an Authorization: Bearer header. Other values still use basic auth, so current workflows do not change.

 teamwork::request
-  curl -u "$TEAMWORK_API_TOKEN:" ...
+  if token starts with "tkn."
+    curl -H @- ... <<< "Authorization: Bearer $TEAMWORK_API_TOKEN"
+  else
+    curl -u "$TEAMWORK_API_TOKEN:" ...

Curl reads the bearer header from stdin, so the token does not show in the runner's process list. The README links to the authentication guide, which tells how to get a token.

Evidence

The mock Teamwork API now also accepts Bearer tkn.test-token. There are two new cases:

  • bearer-token: INPUT_TEAMWORK_API_TOKEN=tkn.test-token → GET /tasks/1001 -> 200, POST /comments -> 201, exit 0

  • wrong-bearer-token: INPUT_TEAMWORK_API_TOKEN=tkn.wrong-token → GET /tasks/1001 -> 401, exit 1

  • Before: a tkn. token goes as basic auth → 401
    After: tests/run.sh → All 24 case(s) passed

Merge Danger

Door: two-way

To revert, revert the commit. Nothing is stored or migrated.

Blast Radius: auth

A value that starts with tkn. now goes as a bearer token, not with basic auth. If an API key starts with tkn., its requests will fail. This is not probable.

A token that starts with "tkn." goes in a Bearer header, read by curl
from stdin so it stays out of the process list. Other values still use
basic auth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rafaeljusto
rafaeljusto requested a review from a team as a code owner November 18, 2026 16:17
@rafaeljusto
rafaeljusto merged commit f1583e6 into master Nov 18, 2026
2 checks passed
@rafaeljusto
rafaeljusto deleted the bearer-token-auth branch November 18, 2026 17:28
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