【发布时间】:2020-05-26 14:42:59
【问题描述】:
这是Angular App Hosting Azure Storage Container - Azure Authentication Callback and Routing fails 的后续问题。
总结:
我想在 Azure 存储帐户上托管我的 Angular 8 应用程序。为了使路由工作,我必须打开 HashLocationStrategy。这个策略在路由前加上这样的标签:https://<projectname>.z6.web.core.windows.net/#/auth/login
路由现在可以正常工作,但 Azure OAuth2 进程也使用井号标签将访问令牌信息添加到基本 URL:<baseurl>/<callbackurl>#access_token=eyJ0eXAiOiJKV1Q...。
不使用 HashLocationStrategy 的路由是这样的(回调路由是/auth/callback):
https://<projectname>.z6.web.core.windows.net/auth/callback#access_token=eyJ0eXAiOiJKV1Q...
使用 HashLocationStrategy 应该是这样的:
https://<projectname>.z6.web.core.windows.net/#/auth/callback#access_token=eyJ0eXAiOiJKV1Q...
但它的作用是这样的:
https://<projectname>.z6.web.core.windows.net/#access_token=eyJ0eXAiOiJKV1Q...
它只是吞下回调 url 部分并将 access_token 部分直接添加到基本 url 后面。重定向失败。
有没有办法让 Azure OAuth2 与 HashLocationStrategy 一起工作?
【问题讨论】:
标签: angular oauth-2.0 azure-active-directory azure-blob-storage hash-location-strategy