Solved

Access denied when using Branches

  • 12 August 2022
  • 3 replies
  • 349 views

Userlevel 3
Badge

Hi there,

 

I am using branches for a new piece of functionality. As far as my understanding goes, I create a branch in contentstack. This allows me to control the content side of things independantly from another branch.

If I want to test the front end differences out, I create an alias pointing towards my branch. Then, I take that alias, and I put it in the Contentstack.Stack SDK interface like so:

 

const Stack = contentstack.Stack({
  api_key: process.env.CONTENTSTACK_API_KEY,
  delivery_token: process.env.CONTENTSTACK_DELIVERY_TOKEN,
  environment: process.env.CONTENTSTACK_ENVIRONMENT,
  region: process.env.CONTENTSTACK_REGION ? process.env.CONTENTSTACK_REGION : 'us',
  branch: 'testalias'
});

Where testalias is the name of the alias I created. I am now getting an Access Denied error when trying to visit a page that is published on that branch. Any advice?

 

Error: {"error_message":"Access denied. You have insufficient permissions to perform operation on this branch 'testalias'.","error_code":901}

icon

Best answer by nick.nguyen 15 August 2022, 18:09

View original

3 replies

Userlevel 4

Hey Tyler,

You might need to update settings in the tokens section to give access to the specific alias or branch.

-Nick

Userlevel 3
Badge

Hi @nick.nguyen I think that will probably fix the issue. I would suggest adding that to your documentation, nothing inside the branches docs (at time of writing) mentioned access.

 

Thanks!

Userlevel 4

Hi @Tyler ,

 

I will pass that along to make it more up front than currently. In our global modules of the branches documentation there is a tokens section that specifies

Both the delivery and management tokens can be assigned to specific branches of the stack.

You can also assign management tokens to specific aliases to fetch or manage data from their associated branches.

but it could definitely be a bit more follow along about actually setting the access branches.

 

Cheers,

Nick

Reply