Setting up a new environment

Hello everyone, despite I read also some posts from other people with my similar issues and after tried theirs fix, I still don’t manage to connect to my new environment.

So I am sure my environment it is NOT on the way to be created, I already places content, and create a new token API under it, with editor role. But I anyway get the “401 …INVALID_AUTHORIZATION_HEADER”. So I also read that, can be used the graphql.datocms.com end point and so on, so this is my code. It seems still I might be missing something

import { GraphQLClient } from "graphql-request";
export function request({ query, variables, preview, includeDrafts }) {
    const endpoint = preview
        ? `https://graphql.datocms.com/preview`
        : `https://graphql.datocms.com/`;


    const headers = {
        authorization: `Bearer ${process.env.VUE_APP_CMS_DATOCMS_API_TOKEN_DEV}`,
        "X-Environment": "developer"
    };

    if (includeDrafts) {
        headers['X-Include-Drafts'] = 'true';
    }
    const client = new GraphQLClient(endpoint, { headers });

    return client.request(query, variables);
}

Also to add on top, I went to the API explorer, and when trying to filter the records with the new token, i got a blank page, with the following error on console

Will be glad if someone can give me a bit of light :slight_smile: . Thank you in advance

Hello @maria.arce

Could you go to the page of roles on the editor role and make sure that this is not the Roles permission for other environments?

Hello @m.finamor , thank you for the answer, that is interesting, i didn’t that, so for now I did create a new role, and assign basically the same permissions like editor, with the difference I tried with each of those two:

And then of course on my token I changed to be under that role, that is called “developer”. However I’m still getting the same issue. I opened in a new tab and cleaned the cache(just in case):

@maria.arce , could you send us the GraphQL request body + headers, as well as the project link, and the last 4 digits of the API token you are using to make that request, to us over at support@datocms.com so we can take a closer look at what could be happening?
Thank you!

Just to close the issue after the email followup:
The problem was that the role associated to the API token had no “Content Permissions” set, and therefore couldn’t access any content.