Request: allow injected token to work for GraphQL API as well

I’m developing some plugins and noticing that ctx.currentUserAccessToken works if I pass it to the SiteClient from 'datocms-client', but it does not work if I try to make a request against the GraphQL Content Delivery API using fetch, which is much more convenient for certain data shapes.

This seems like a needless restriction :man_shrugging:, since any token for the Content Management API is obviously a higher level of permission—is there another way around it?

Hey @lunelson, CMA API keys are not necessarily with a higher level of permission, they’re different sets that could intersect or not :slight_smile: It would be interesting to know your use case! What are you trying to accomplish?

In this use-case, I was trying to traverse through the “parents” of tree-sorted records, to build up a slug value. So I had a graphQL query looking something like this, which I don’t know how I’d do on the CMA except through multiple calls:

  fragment PageSlug on PageRecord {
    slug
    parent {
      slug
      parent {
        slug
        parent {
          slug
          parent {
            slug
          }
        }
      }
    }
  }