Hi everyone!
I'm having some trouble with getting authenticated with the v2 endpoint.
This is what I'm currently doing:
const response = await fetch(
`https://****.cdn.prismic.io/api/v2?access_token=${prismicToken}`,
)
const parsedResponse = await response.json()
const masterRef =
parsedResponse &&
parsedResponse.refs &&
parsedResponse.refs.find(ref => ref.isMasterRef)
const url = new URL(`https://****.cdn.prismic.io/api/v2/documents/search`) endpoint instead?
const params = {
ref: masterRef.ref,
q: '[[ at(my.url_redirects.uid,"all_redirects") ]]',
access_token= prismicToken
}
I'm using the access_token which I created in the Prismic UI (under Permanent access tokens)
The first request to get the master ref works successfully, however when I do the search request I receive an error showing this:
{
"error": "Access to this Ref requires an access token",
"oauth_initiate": "https://***.cdn.prismic.io/auth",
"oauth_token": "https://***.cdn.prismic.io/auth/token"
}
Can I get some support to know what I'm doing incorrectly?
The API access for this repository is currently: "Public API for Master only - Require an access token to preview future releases".
Just to be clear I want to add the auth_token incase the Prismic API access becomes private.
Many thanks!