SaaS CMS has officially launched! Learn more now.

Virtual role addition for ContentDeliveryAPI


As per the documentation I have set up the Content delivery API . As suggested I have added the virtual role:

<add name="contentapiread" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="Everyone" mode="Any" />

With above line when role is set to Everyone the Content delivery API response is coming up fine. However when I assign a role

<add name="contentapiread" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="Everyone" mode="CMSAdmins MyRole1 MyRole2 MyRoleGroup1" />

The Id i used to login to the site is having CMSAdmins as the role but Content Delivery API responsds with Forbidden. 

What am I missing here ?

Mar 03, 2020 21:31

It looks like you have assigned the roles to the 'mode' attribute rather than the 'roles' one. Keep 'mode' as 'Any' and replace 'Everyone' with your role list. 

Mar 06, 2020 23:23

Sorry about that. It was a typo but I have mode as Any and roles of what it should be.

Mar 09, 2020 21:20

Do you mean that it was a typo in your question or in your web.config? Also, are the roles separated by comma?

<add name="contentapiread" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="CMSAdmins, MyRole1, MyRole2, MyRoleGroup1" mode="Any" />
Mar 09, 2020 21:36

Sorry for any confusion. It was typo in my question. My web.config is correct as per the documentation and as you have mentioned above.

Mar 10, 2020 13:35

This turned out to be issue with authorization where claims were not be set correctly.

Apr 01, 2020 0:14
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.