应用程序见解 setAuthenticatedUserContext with API on another domain

Application insights setAuthenticatedUserContext with API on another domain

我在网站的前端和后端都配置了 Application Insights,它们在不同的子域上运行(假设 www.mydomain.comapi.mydomain.com)。

包含setAuthenticatedUserContext设置的用户信息的cookie由AI存储,cookie域设置为www.mydomain.com。当我调用 api.mydomain.com 时,cookie 不包括在内,因此我设置的凭据与 API.

记录的任何 AI 数据无关

我的 API 已将 Access-Control-Allow-Credentials 设置为 true,前端已将 XHR 对象上的 withCreditials 设置为 true

我能否让 AI 设置不同的 cookie 域,或者这里是否存在其他问题阻止用户信息到达 API?

更新: 我注意到 Google Analytics 设置了一个 cookie,域设置为 .mydomain.com,并且此 cookie 信息包含在对我的调用中API.

目前不支持此功能,但在 GH 上为此打开了一个问题:https://github.com/Microsoft/ApplicationInsights-JS/issues/64 请继续关注 GH link,我们会尽快提供更新。谢谢!