PHP SDK returning 403 error after changes in CMS

Hi,

In our application we are using the PHP SDK of Prismic and we use Laravel as our PHP framework. Lately we have been getting some errors when there are updates within the Prismic CMS.

The following error is what we receive from our error reporting tool:

Client error: `GET https://<OUR_HOST>.cdn.prismic.io/api/v1/documents/search?page=1&pageSize=100&access_token=<OUR_ACCESS_TOKEN>` resulted in a `403 Forbidden` response: {"error":"Access to this Ref requires an access token","oauth_initiate":"https://<OUR_HOST>.cdn.prismic.io/auth"," (truncated...)

This only seems to be happening when we are making changes in the CMS. I tried looking up this issue on the forums here but couldn't find anything that looks similar yet. Anyone that may be able to assist?

Thanks!

Hello @oneshoe

Welcome to the Prismic forum and thanks for posting this question to us.

Whenever you do some changes in the Prismic documents, you need to save and publish the documents and it changes the master ref value. You need to put the new master ref.

You can find the master ref if you visit your projects API browser at:

https://your-repo-name.prismic.io/api/v2

Please check an example here:

https://{my-repo_name}.cdn.prismic.io/api/v2/documents/search?ref={my_master_ref}&access_token={my_access_token}#format=json

Hi @Priyanka, Thanks for your reply!

The master ref is something we do not set, the webhook calls a cache:clear on our website and the Prismic API should retrieve a new master ref. The weird thing is that this always used to work but in the last weeks it suddenly stopped working and is showing this issue sporadically, which makes it hard to reproduce.

FYI, we use the v1 API and use the laravel SDK package.

Hello @oneshoe

I need more information to dig it on my side.

  1. Which browser are you using?
  2. Is your repo set private?
  3. Try to clear the cache on the browser.
  4. It is happening on both production/development builds?

Can you please send me the Prismic repo and project Zip file? You can send me a private message too.

Thanks,
Priyanka

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.