@cody Finally got this working in a reasonable, albeit not ideal way. It boiled down to disabling the silent authentication via iframe by reducing the timeout to 0. Once the timeout is hit, Microsoft's authentication library falls back to a conventional PKCE redirect. Unfortunately, I couldn't find a way to override the timeout value via an option in the Program.cs
file. So instead, I copied the contents of the AuthenticationService.js
file into my project, and instead of importing from the nuget package, I just use that local copy:
<!-- <script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script> -->
<script src="./AuthenticationService.js"></script>
with this singular change (line 12474
in version 7.0.11):
// var e = t.silentRequestTimeout || 1e4;
var e = 0;
This removes the need for the iframe to work altogether, and basically gets the authentication library to do what you'd expect.
I dunno if there's a spec somewhere for how silent authentication is performed via iframe, but any other identity provider I tried out using Microsoft's package - Okta, Google, Auth0, Azure AD - they all seemed to handle the iframe fine. Would be nice if FusionAuth did the same so this debacle could be avoided for other Blazor WASM apps. It might be as simple as checking if the auth flow is occurring in an iframe, and calling postMessage
after authenticating, though I'm really not sure.
Anyways, hope some of this info may help someone else.