Skill Tracer
Skills › Scientific Agent Skills › protocolsio-integration › authentication.md

authentication.md

138 lines · skills/protocolsio-integration/references/authentication.md at 5f2bc03

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# Authentication and Credential Safety
2
3Verified **2026-09-30** against the official
4[Developer resources](https://www.protocols.io/developers) page and
5[API authentication reference](https://apidoc.protocols.io/).
6

Authentication and Credential Safety

Verified 2026-09-30 against the official Developer resources page and API authentication reference.

Raw lines 1 to 6
7## Access Model
8
9The official documentation names two bearer-token modes:
11| Mode | Officially documented use | Safe default |
12|---|---|---|
13| Client access token | The Developer resources page says it can read all public data. The API authentication section additionally says it can access the creating user's private content. | Treat it as public-read unless the exact account/endpoint behavior and permissions have been verified. |
14| OAuth access token | Public content plus the authorizing user's permitted private content. | Use only for a multi-user application or a user-approved private/write workflow. |
16The two official descriptions of client-token private access are not perfectly
17aligned. Do not use that ambiguity as authorization. Check the returned access
18flags and the user's intended scope before touching private content.
20“Public protocol” describes the resource's visibility; it does not imply that a
21REST call is anonymous. The current list/get endpoint sections require
22`Authorization: Bearer ...`. The official PDF section documents signed-in and
23signed-out rates, so the bundled client allows anonymous access only when
24`export-pdf --anonymous` is explicit.

Access Model

The official documentation names two bearer-token modes:

ModeOfficially documented useSafe default
Client access tokenThe Developer resources page says it can read all public data. The API authentication section additionally says it can access the creating user's private content.Treat it as public-read unless the exact account/endpoint behavior and permissions have been verified.
OAuth access tokenPublic content plus the authorizing user's permitted private content.Use only for a multi-user application or a user-approved private/write workflow.

The two official descriptions of client-token private access are not perfectly aligned. Do not use that ambiguity as authorization. Check the returned access flags and the user's intended scope before touching private content.

“Public protocol” describes the resource's visibility; it does not imply that a REST call is anonymous. The current list/get endpoint sections require Authorization: Bearer .... The official PDF section documents signed-in and signed-out rates, so the bundled client allows anonymous access only when export-pdf --anonymous is explicit.

Raw lines 7 to 25
26## Named Variables
28The bundled scripts read only `PROTOCOLS_IO_ACCESS_TOKEN`, the bearer token
29used by the read helper. They do not read OAuth client credentials or refresh
30tokens. A separately reviewed confidential application should keep those
31credentials in its own secret-manager scope and perform OAuth exchange there.
33Never:
35- put any value in source, JSON payloads, command arguments, shell history,
36 notebooks, chat, screenshots, logs, exception text, or output;
37- enumerate unrelated environment variables;
38- load or search for `.env` files;
39- print a value, prefix, suffix, length, hash, or decoded form;
40- send a protocols.io bearer token to an attachment URL, S3 URL, redirect, or
41 any host other than the explicitly validated protocols.io API origin.
43Configure secrets through the execution host's credential manager. Validate
44presence locally:
46```bash
47python3 -B scripts/validate_auth_config.py --require read
48```
50The validator reads only the named access token, reports a boolean, performs
51no network access, and never loads `.env`.

Named Variables

The bundled scripts read only PROTOCOLS_IO_ACCESS_TOKEN, the bearer token used by the read helper. They do not read OAuth client credentials or refresh tokens. A separately reviewed confidential application should keep those credentials in its own secret-manager scope and perform OAuth exchange there.

Never:

  • put any value in source, JSON payloads, command arguments, shell history, notebooks, chat, screenshots, logs, exception text, or output;
  • enumerate unrelated environment variables;
  • load or search for .env files;
  • print a value, prefix, suffix, length, hash, or decoded form;
  • send a protocols.io bearer token to an attachment URL, S3 URL, redirect, or any host other than the explicitly validated protocols.io API origin.

Configure secrets through the execution host's credential manager. Validate presence locally:

python3 -B scripts/validate_auth_config.py --require read

The validator reads only the named access token, reports a boolean, performs no network access, and never loads .env.

Raw lines 26 to 52
Runs code scripts/validate_auth_config.py :47
53## OAuth 2.0 Contract
55The current official flow documents:
571. Create/configure the client on
58 `https://www.protocols.io/developers`.
592. Register the exact redirect URL there.
603. Direct the user to
61 `https://www.protocols.io/api/v3/oauth/authorize`.
624. Send `client_id`, `redirect_url`, `response_type=code`,
63 `scope=readwrite`, and a high-entropy, single-use `state`.
645. Verify returned `state` before accepting the authorization `code`.
656. Exchange the code server-side at
66 `POST https://www.protocols.io/api/v3/oauth/token` using
67 `grant_type=authorization_code`, `client_id`, `client_secret`, and `code`.
687. Refresh at the same endpoint with `grant_type=refresh_token`,
69 `client_id`, `client_secret`, and `refresh_token`.
71Use the documented parameter name `redirect_url`; do not silently substitute
72`redirect_uri`. The token response documents `access_token`, `token_type`,
73`expires_in`, `scope`, `refresh_token`, `refresh_expires_in`, and `user`.
75The reference's example scope is `readwrite`. No finer REST scope list was
76found in the official materials reviewed. Therefore:
78- use a client token for public-only discovery;
79- do not initiate OAuth merely because an access token is absent;
80- use `readwrite` only for an authorized user-context workflow requiring OAuth;
81 private read workflows still receive this broad documented scope;
82- enforce narrower authorization in the application even if the upstream
83 token is broad;
84- recheck the live developer page before production authorization, because
85 scope support can change.
87Do not perform OAuth token exchange in a browser-only client or general agent
88transcript. Keep the client secret and token endpoint in a confidential
89server-side component with redacted observability.

OAuth 2.0 Contract

The current official flow documents:

  1. Create/configure the client on https://www.protocols.io/developers.
  2. Register the exact redirect URL there.
  3. Direct the user to https://www.protocols.io/api/v3/oauth/authorize.
  4. Send client_id, redirect_url, response_type=code, scope=readwrite, and a high-entropy, single-use state.
  5. Verify returned state before accepting the authorization code.
  6. Exchange the code server-side at POST https://www.protocols.io/api/v3/oauth/token using grant_type=authorization_code, client_id, client_secret, and code.
  7. Refresh at the same endpoint with grant_type=refresh_token, client_id, client_secret, and refresh_token.

Use the documented parameter name redirect_url; do not silently substitute redirect_uri. The token response documents access_token, token_type, expires_in, scope, refresh_token, refresh_expires_in, and user.

The reference's example scope is readwrite. No finer REST scope list was found in the official materials reviewed. Therefore:

  • use a client token for public-only discovery;
  • do not initiate OAuth merely because an access token is absent;
  • use readwrite only for an authorized user-context workflow requiring OAuth; private read workflows still receive this broad documented scope;
  • enforce narrower authorization in the application even if the upstream token is broad;
  • recheck the live developer page before production authorization, because scope support can change.

Do not perform OAuth token exchange in a browser-only client or general agent transcript. Keep the client secret and token endpoint in a confidential server-side component with redacted observability.

Raw lines 53 to 90
91## Lifetime and Refresh
93The official authentication page says an OAuth access token resets after about
94one year, returns an `expires_in` value, and warns one month before expiry with
95`warning_code: 1`. It documents API `status_code: 1219` and “token is expired”
96after expiry. Treat the response fields—not a hardcoded calendar interval—as
97authoritative.
99On refresh, the documentation says old tokens stop working. Store the newly
100returned access and refresh credentials atomically, then revoke or discard the
101old pair. Never log the response body.

Lifetime and Refresh

The official authentication page says an OAuth access token resets after about one year, returns an expires_in value, and warns one month before expiry with warning_code: 1. It documents API status_code: 1219 and “token is expired” after expiry. Treat the response fields—not a hardcoded calendar interval—as authoritative.

On refresh, the documentation says old tokens stop working. Store the newly returned access and refresh credentials atomically, then revoke or discard the old pair. Never log the response body.

Raw lines 91 to 102
103## Header Handling
105Endpoint examples use the standard `Authorization: Bearer ...` header. The
106authentication introduction contains a label typo (“Authentication”), so use
107the endpoint contract and standard header name.
109Build the header only inside the HTTP transport immediately before a validated
110request. Redact it from plans, tracing, error reports, and mocks. Disable
111redirects; do not assume a same-site redirect is safe for a bearer credential.

Header Handling

Endpoint examples use the standard Authorization: Bearer ... header. The authentication introduction contains a label typo (“Authentication”), so use the endpoint contract and standard header name.

Build the header only inside the HTTP transport immediately before a validated request. Redact it from plans, tracing, error reports, and mocks. Disable redirects; do not assume a same-site redirect is safe for a bearer credential.

Raw lines 103 to 112
113## Least-Privilege Checklist
115Before any authenticated operation:
1171. identify whether the resource is public, private, shared, or tenant-scoped;
1182. choose client access for public reads and OAuth only when user context is
119 necessary;
1203. verify owner/workspace access flags returned by the API;
1214. restrict protocol IDs, workspace URI, tenant origin, page/item count, and
122 response bytes;
1235. separate read credentials from any service capable of writes;
1246. require a current snapshot and fresh confirmation for every mutation;
1257. rotate credentials after suspected disclosure and remove exposed logs.

Least-Privilege Checklist

Before any authenticated operation:

  1. identify whether the resource is public, private, shared, or tenant-scoped;
  2. choose client access for public reads and OAuth only when user context is necessary;
  3. verify owner/workspace access flags returned by the API;
  4. restrict protocol IDs, workspace URI, tenant origin, page/item count, and response bytes;
  5. separate read credentials from any service capable of writes;
  6. require a current snapshot and fresh confirmation for every mutation;
  7. rotate credentials after suspected disclosure and remove exposed logs.
Raw lines 113 to 126
127## Source Notes
129- [Developer resources](https://www.protocols.io/developers), accessed
130 2026-09-30 — REST API link, client access, credential creation, OAuth setup.
131- [API authentication and OAuth reference](https://apidoc.protocols.io/),
132 accessed 2026-09-30 — token modes, `readwrite`, authorize/token paths,
133 response fields, lifetime/refresh behavior.
134- [Official MCP server](https://www.protocols.io/mcp-server),
135 accessed 2026-09-30 through rendered extraction — endpoint/auth, public
136 read tools, temporary Claude Connector unavailability. Its public-content
137 tool descriptions are narrower than the API page's OAuth access statement;
138 verify actual tool permissions before relying on private MCP reads.

Source Notes

  • Developer resources, accessed 2026-09-30 — REST API link, client access, credential creation, OAuth setup.
  • API authentication and OAuth reference, accessed 2026-09-30 — token modes, readwrite, authorize/token paths, response fields, lifetime/refresh behavior.
  • Official MCP server, accessed 2026-09-30 through rendered extraction — endpoint/auth, public read tools, temporary Claude Connector unavailability. Its public-content tool descriptions are narrower than the API page's OAuth access statement; verify actual tool permissions before relying on private MCP reads.
Raw lines 127 to 138
Uses an outside tool MCP :134