Skip to content

fix(hosted-wasm): load OIDC AuthenticationService script before Blazor startup - #915

Draft
sfmskywalker with Copilot wants to merge 2 commits into
release/3.8.0from
copilot/fix-authentication-service-init
Draft

fix(hosted-wasm): load OIDC AuthenticationService script before Blazor startup#915
sfmskywalker with Copilot wants to merge 2 commits into
release/3.8.0from
copilot/fix-authentication-service-init

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Purpose

Hosted WASM startup could fail with Could not find 'AuthenticationService.init' ('AuthenticationService' was undefined) when OIDC auth initialized. This PR ensures the required Microsoft authentication runtime script is present in the hosted entry page before Blazor bootstraps.


Scope

Select one primary concern:

  • Bug fix (behavior change)
  • Refactor (no behavior change)
  • Documentation update
  • Formatting / code cleanup
  • Dependency / build update
  • New feature

If this PR includes multiple unrelated concerns, please split it before requesting review.


Description

Problem

Hosted WASM (Elsa.Studio.Host.HostedWasm) did not include the WebAssembly auth static asset required by RemoteAuthenticationService / RemoteAuthenticatorView, resulting in AuthenticationService.init missing at runtime.

Solution

  • Hosted entry page script wiring
    • Added Microsoft’s auth script include to /Pages/_Host.cshtml before _framework/blazor.webassembly.js.
  • Startup compatibility
    • Aligns hosted WASM boot sequence with the standalone WASM host and module expectations for OIDC.
<script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script>
<script src="_framework/blazor.webassembly.js" autostart="false"></script>

Verification

Steps:

  1. Run hosted WASM host (Elsa.Studio.Host.HostedWasm) with Authentication:Provider=OpenIdConnect.
  2. Open the app and trigger authentication state resolution (normal startup path is sufficient).
  3. Confirm no AuthenticationService.init JS interop error appears.

Expected outcome:
OIDC auth initializes without AuthenticationService-undefined runtime failures.


Screenshots / Recordings (if applicable)

N/A (startup/runtime wiring fix, no UI change).


Commit Convention

We recommend using conventional commit prefixes:

  • fix: – Bug fixes (behavior change)
  • feat: – New features
  • refactor: – Code changes without behavior change
  • docs: – Documentation updates
  • chore: – Maintenance, tooling, or dependency updates
  • test: – Test additions or modifications

Clear commit messages make reviews easier and history more meaningful.


Checklist

  • The PR is focused on a single concern
  • Commit messages follow the recommended convention
  • Tests added or updated (if applicable)
  • Documentation updated (if applicable)
  • No unrelated cleanup included
  • All tests pass

Copilot AI changed the title [WIP] Fix undefined AuthenticationService during initialization fix(hosted-wasm): load OIDC AuthenticationService script before Blazor startup Jul 2, 2026
Copilot AI requested a review from sfmskywalker July 2, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Could not find 'AuthenticationService.init' ('AuthenticationService' was undefined).

2 participants