AccessTokenInvalid error

I’m trying to setup the preview mode in my app but I keep getting the same error even though I’m following the official documentation:

{
  sys: { type: 'Error', id: 'AccessTokenInvalid' },
  message: 'The access token you sent could not be found or is invalid.',
  requestId: ...
}

I currently have only one API Key enable and one Contenful project. I tried copying the preview token multiple times but it doesn’t seem to be the problem. With the following logic, the Delivery API works but the Preview API gives me the error:

    this.client = createClient({
      space: process.env.CONTENTFUL_SPACE,
      accessToken: preview
        ? process.env.CONTENTFUL_PREVIEW_TOKEN
        : process.env.CONTENTFUL_TOKEN,
      environment: process.env.CONTENTFUL_ENV,
      host: preview ? "https://preview.contentful.com" : "https://cdn.contentful.com",
    });

Do you give API key access to the correct environment?

I do yes, I figured that the issue is the protocol in my host parameter.
So instead of “https://preview.contentful.com”, it should be “preview.contentful.com”.

Strange enough, it seems that it’s working fine with or without the protocol for “cdn.contentful.com”.

Why is host not listed as a required parameter in Preview API docs?