gpt4 book ai didi

angular - 错误的重定向到本地主机

转载 作者:行者123 更新时间:2023-12-03 12:38:18 25 4
gpt4 key购买 nike

我构建了一个与 MS Graph API 通信的 Angular 应用程序,为此我使用了 MSAL。在 Angular CLI 中使用“ng serve”时,一切正常。
后来我用 Electron 包裹了这个 Angular 应用程序,将它部署为桌面应用程序。启动 Electron 时,通过 Microsoft 登录可以正常工作,但登录后我被重定向到错误的本地主机地址。
我被重定向到 http://localhost:8080/但我的重定向 URI 是 http://localhost:8080/#/home。
当重定向到错误地址时,错误连接被拒绝出现在开发控制台/网络中,并且屏幕在 Electron 中保持空白。
这是 Azure AD 的问题吗?
我无法在 Azure AD 中删除和重新注册我的应用程序(如此处所示 Azure AD redirects to wrong location (localhost) after authentication),因为我在公司环境中。
任何人都可以与此相关吗?

最佳答案

我找到了解决我的问题的方法。我将重定向更改为 localhost:8080/没有哈希和它后面的所有内容。问题是服务器只重定向到哈希之后没有所有内容的部分。这是因为 HashLocationStrategy。因此,当我将 Redirect 配置为 localhost:8080/#/它实际上重定向到 localhost:8080/

关于angular - 错误的重定向到本地主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65231060/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com