microsoft / Reporting-Services

Git repo for SQL Server Reporting Services and Power BI paginated report samples, and community projects
MIT License
424 stars 361 forks source link

Power BI Report Server - Custom Visual 401 Unauthorized #172

Open metinsevindik opened 4 years ago

metinsevindik commented 4 years ago

Hi,

I have a problem in a powerbi report. Error details

Thanks

gboreki commented 4 years ago

Are still seeing this problem? Which version of PBIRS?

akoneru commented 4 years ago

I encountered the same issue. For the requests related to custom visuals, the session auth cookie is being dropped by the browsers. As a workaround for this, I changed the web.config on Report server as -

For newer browsers' restrictions on same-site cookies, the request has to be marked as secure and sent through https. If you can have https configured on the report server, you can use the following config which will automatically mark cookie as secure.

In my case https is handled at the firewall, while the report server gets HTTP traffic only. As a workaround for this, I mark the cookie as secure in login.aspx.cs as -

Response.Cookies["sqlAuthCookie"].Secure = true;

This is accepted by the browser as a secure cookie since it is sent as https outside the firewall.

This solution worked as expected for me.

xucito commented 9 months ago

This is still a major issue. Looks like because VisualResourceLoader.htm loads scripts without use-credentials the cookies are not passed.

Growthgear commented 7 months ago

Hi @akoneru, does Response.Cookies["sqlAuthCookie"].Secure = true; needs to be added in web.config or logon.aspx page load event?

Appreciate your help!