【问题标题】:How can I use OIDC through a custom URL in Blazor Webassembly published on Azure App Service如何通过在 Azure 应用服务上发布的 Blazor Webassembly 中的自定义 URL 使用 OIDC
【发布时间】:2021-09-28 18:52:45
【问题描述】:

我正在尝试使用本地、Google 和 Microsoft 登录来部署 Blazor WASM 解决方案,但在使用自定义 URL 时遇到了问题。

我已经部署到 Azure 应用服务,并按照之前的线程,通过将 service-worker.published.js 修改为 URL MySite.azurewebsites.net 使其工作:

async function onFetch(event) {
    let cachedResponse = null;
    if (event.request.method === 'GET') {
        // For all navigation requests, try to serve index.html from cache
        // If you need some URLs to be server-rendered, edit the following check to exclude those URLs
        const shouldServeIndexHtml = event.request.mode === 'navigate'
            && !event.request.url.includes('/connect/')
            && !event.request.url.includes('/signin-google')
            && !event.request.url.includes('/Identity/');

        const request = shouldServeIndexHtml ? 'index.html' : event.request;
        const cache = await caches.open(cacheName);
        cachedResponse = await cache.match(request);
    }

    return cachedResponse || fetch(event.request);
}

我现在的问题是我添加了 MySite.co.uk 的自定义 https 域,当我转到 MySite.azurewebsites.net 时该站点仍然可以正常工作,但是当我转到 MySite.co.uk 时它发送我到“对不起,这个地址什么都没有”页面。

关于如何将这一切连接起来以允许使用自定义域的任何建议?谢谢!

【问题讨论】:

    标签: azure-web-app-service openid-connect blazor-webassembly


    【解决方案1】:

    看起来这与登录页面上使用的 javascript 库有关。一旦我解决了 javascript 控制台中的所有错误,它就开始工作了,所以不确定是哪一个修复了它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-01
      • 1970-01-01
      • 2020-07-04
      • 1970-01-01
      • 1970-01-01
      • 2020-10-31
      • 2020-09-15
      • 1970-01-01
      相关资源
      最近更新 更多