PubPub.createSDK cannot authenticate when Cloudflare blocks API requests. I noticed other related open issues about SDK api access - will you fix please.
Summary
The documented SDK authentication method does not work when Cloudflare blocks the initial API request.
Reproduction
import { PubPub } from '@pubpub/sdk';
await PubPub.createSDK({
communityUrl: 'https://example.pubpub.org',
authToken: process.env.PUBPUB_AUTH_TOKEN!,
});
Actual result
The SDK throws:
However, the underlying request to:
GET /api/communities
Authorization: Bearer <token>
returns HTTP 403 with a Cloudflare challenge/block page. The token is therefore not evaluated by the PubPub API.
The same occurs for API requests such as /api/collections and /api/pubs.
Expected result
Authenticated SDK requests should not be blocked by Cloudflare, or the SDK should detect the Cloudflare response and report it clearly instead of reporting an invalid token.
PubPub.createSDK cannot authenticate when Cloudflare blocks API requests. I noticed other related open issues about SDK api access - will you fix please.
Summary
The documented SDK authentication method does not work when Cloudflare blocks the initial API request.
Reproduction
Actual result
The SDK throws:
However, the underlying request to:
returns HTTP
403with a Cloudflare challenge/block page. The token is therefore not evaluated by the PubPub API.The same occurs for API requests such as
/api/collectionsand/api/pubs.Expected result
Authenticated SDK requests should not be blocked by Cloudflare, or the SDK should detect the Cloudflare response and report it clearly instead of reporting an invalid token.