We have an issue with Sitecore 9.1 context user on Preview mode.
Sitecore.Context.User is showing as "extranet\Anonymous" in preview mode when Sitecore CM is authenticating via Identity Server. Whereas in experience editor mode, it's showing as "sitecore\admin"
When we disable Identity server for Sitecore CM, in preview mode, Sitecore.Context.User is showing properly as "sitecore\admin".
We have set Preview.AsAnonymous setting as "False".
Expectation: Sitecore Preview should show the same user account who has logged-in instead of extranet\Anonymous. This behavior is causing issue to render page in preview mode which is protected for Anonymous users.
Note: In Sitecore 8.2, similar settings of preview and similar Sitecore item security works well without issue.
Does anyone know why Sitecore user is not authenticated in preview mode when going through identity server?
Edit: When we turn off the identity server for Sitecore CM, it works as expected. In preview mode, the appropriate user show instead of extranet\Anonymous
Preview.AsAnonymous
setting set totrue
?