The following code works just fine on my public repos, but it won't work on my private repos with a master+releases
permanent access token and I'm unclear as to why.
const client = prismic.createClient(repos[repo], {
accessToken: `${repos[repo]
.toUpperCase()
.replace(/-/g, '_')}_PRISMIC_TOKEN`
});
[...]
const posts = await client.getAllByType(types[t]);
This throws Invalid access token
when attempting to access the private repo. I have tried creating multiple tokens and none have worked.
Fares
June 24, 2022, 3:40pm
3
Hi @ecommerce-team ,
Thanks for reaching out.
I'm not sure I understand why you do this code? and why did you modify the access token?
`${repos[repo]
.toUpperCase()
.replace(/-/g, '_')}_PRISMIC_TOKEN`
This is just referencing the environment variable in which the token is located, which switches depending on the environment.
I see my error though, so never mind
Fares
July 4, 2022, 8:46am
6
Thanks for letting us know.
Would it be possible to share the solution to the issue to the benefit of the community?