Content API in webworker script and returning member-only content

Attempting to build a JSON index of certain posts to be ingested-by/hydrate a React application bundled in a theme. I do this in a separate thread via a worker script Fetch’ing from the Content Api’s posts endpoint. All is well for public posts.

Maybe I’ve invented this memory, but I thought there was a way to get full post data (i.e. the html key) for logged in members. Passing their token in the header of the request perhaps?

(there is an old and possibly out of date comment from Kevin here about using the content api with JWTs, but I’m not following how that would be done.)

I noticed there is a membersToken param for the makeApiRequest function, but it seems inaccessible .

//https://github.com/TryGhost/SDK/blob/main/packages/content-api/lib/content-api.js#L155
...
    function makeApiRequest(resourceType, params, id, membersToken = null) {
        if (!membersToken && !key) {
            return Promise.reject(
                new Error(`${name} Config Missing: 'key' is required.`)
            );
        }
        delete params.id;

        const headers = membersToken ? {
            Authorization: `GhostMembers ${membersToken}`
        } : {};

        if (userAgent) {
...

I may have this confused with something else, but the point stands that I’m trying to find a way to do this. That is, to retrieve the needed posts and their content for the requesting members tier/permission/etc.

Do i need the admin api and a separate app to do this? (cloudflare worker or something?)
Or is there a frontend safe way to query the Content Api, with a logged in member, and retrieve the full data for the posts they have access to?

Thanks in advance for any clarifications and pointers!

tagging @Kevin since I’m referencing his comment above, and in the hopes he can find time to elaborate on that :grinning:

Closing this so i can rephrase my question better.