<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Blazor WASM auth]]></title><description><![CDATA[<p dir="auto">Currently trying to get Blazor WASM (Web Assembly) to work with Fusion Auth.</p>
<p dir="auto">My initial issue was to get to fusion auth at all and I was having a CORS issue. I ended up having to enable all CORS origins for now.<br />
<img src="/community/forum/assets/uploads/files/1605108140129-2f638e5e-2333-48a3-aa58-608817fab52c-image.png" alt="2f638e5e-2333-48a3-aa58-608817fab52c-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Which brings me to the issues I am experiencing now. I believe these are each related to CORS as well and probably only an issue because I am on localhost.</p>
<ol>
<li>
<p dir="auto">I am not getting a clean redirect to FusionAuth. Though, it does eventually redirect to the provider.<br />
<img src="/community/forum/assets/uploads/files/1605108325716-9e06192e-854a-4903-a2b2-52aeb56411df-image.png" alt="9e06192e-854a-4903-a2b2-52aeb56411df-image.png" class=" img-fluid img-markdown" /><br />
Refused to display '<a href="http://localhost:9011/oauth2/authorize?client_id=ff87ab0d-0a7e-4bcc-af02-8fbf31a92b66&amp;redirect_uri=https%3A%2F%2Flocalhost%3A5001%2Fauthentication%2Flogin-callback&amp;response_type=code&amp;scope=openid%20profile%20openid&amp;state=30eaea5137a6491eb2447547c6948c7a&amp;code_challenge=6KbxXv06jvGjTIG_KxvY2K6HRHy9v52z22usno4BnYk&amp;code_challenge_method=S256&amp;prompt=none&amp;response_mode=query" rel="nofollow ugc">http://localhost:9011/oauth2/authorize?client_id=ff87ab0d-0a7e-4bcc-af02-8fbf31a92b66&amp;redirect_uri=https%3A%2F%2Flocalhost%3A5001%2Fauthentication%2Flogin-callback&amp;response_type=code&amp;scope=openid profile openid&amp;state=30eaea5137a6491eb2447547c6948c7a&amp;code_challenge=6KbxXv06jvGjTIG_KxvY2K6HRHy9v52z22usno4BnYk&amp;code_challenge_method=S256&amp;prompt=none&amp;response_mode=query</a>' in a frame because it set 'X-Frame-Options' to 'deny'.</p>
</li>
<li>
<p dir="auto">Once I login and get back from Fusion Auth, I get the following error:<br />
<img src="/community/forum/assets/uploads/files/1605108440792-4f2eef4d-ef4e-4293-a893-8b8410d00a80-image.png" alt="4f2eef4d-ef4e-4293-a893-8b8410d00a80-image.png" class=" img-fluid img-markdown" /><br />
Access to XMLHttpRequest at '<a href="http://localhost:9011/oauth2/token" rel="nofollow ugc">http://localhost:9011/oauth2/token</a>' from origin '<a href="https://localhost:5001" rel="nofollow ugc">https://localhost:5001</a>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.<br />
<em>And</em><br />
POST <a href="http://localhost:9011/oauth2/token" rel="nofollow ugc">http://localhost:9011/oauth2/token</a> net::ERR_FAILED</p>
</li>
</ol>
<p dir="auto">My <strong>Program.cs</strong> file looks like the following:</p>
<pre><code>public class Program
{
    public static async Task Main(string[] args)
    {
        var builder = WebAssemblyHostBuilder.CreateDefault(args);
        builder.RootComponents.Add&lt;App&gt;("#app");

        builder.Services.AddScoped(sp =&gt; new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

        builder.Services.AddOidcAuthentication(options =&gt;
        {
            builder.Configuration.Bind("FusionAuth_test", options.ProviderOptions);

            options.ProviderOptions.ResponseType = "code";
            options.ProviderOptions.RedirectUri = "https://localhost:5001/authentication/login-callback";
            options.ProviderOptions.PostLogoutRedirectUri = "https://localhost:5001/";
            options.ProviderOptions.DefaultScopes.Add("openid");
        });

        await builder.Build().RunAsync();
    }
}
</code></pre>
<p dir="auto">Where <code>FusionAuth_Test</code> config looks like the following:</p>
<pre><code>{
  "Local": {
    "Authority": "https://login.microsoftonline.com/",
    "ClientId": "33333333-3333-3333-33333333333333333"
  },
  "FusionAuth_test": {
    "Authority": "http://localhost:9011",
    "ClientId": "myIDhere"
  }
}
</code></pre>
<p dir="auto"><strong>To Replicate</strong></p>
<ol>
<li>Use the new .NET 5 sdk.</li>
<li><code>dotnet new blazorwasm -au Individual -o BlazorAuthSample5</code> in the CLI/powershell</li>
<li>copy my <strong>Program.cs</strong> into yours. Only a few lines added/replaced.</li>
<li>change <strong>wwwroot/appsettings.json</strong> to include your fusionAuth clientId</li>
<li><code>dotnet run</code> on folder and try to login</li>
</ol>
]]></description><link>https://fusionauth.io/community/forum/topic/547/blazor-wasm-auth</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 01:42:26 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/topic/547.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 11 Nov 2020 15:36:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Blazor WASM auth on Fri, 06 Oct 2023 13:54:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2022">@cody</a> Thank you for sharing!</p>
]]></description><link>https://fusionauth.io/community/forum/post/6657</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6657</guid><dc:creator><![CDATA[mark.robustelli]]></dc:creator><pubDate>Fri, 06 Oct 2023 13:54:46 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Wed, 04 Oct 2023 15:20:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2022">@cody</a> 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 <code>Program.cs</code> file. So instead, I copied the contents of the <code>AuthenticationService.js</code> file into my project, and instead of importing from the nuget package, I just use that local copy:</p>
<pre><code>&lt;!-- &lt;script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"&gt;&lt;/script&gt; --&gt;
&lt;script src="./AuthenticationService.js"&gt;&lt;/script&gt;
</code></pre>
<p dir="auto">with this singular change (line <code>12474</code> in version 7.0.11):</p>
<pre><code>// var e = t.silentRequestTimeout || 1e4;
var e = 0;
</code></pre>
<p dir="auto">This removes the need for the iframe to work altogether, and basically gets the authentication library to do what you'd expect.</p>
<p dir="auto">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 <code>postMessage</code> after authenticating, though I'm really not sure.</p>
<p dir="auto">Anyways, hope some of this info may help someone else. <img src="https://fusionauth.io/community/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/270c.png?v=rcgg4tg866g" class="not-responsive emoji emoji-android emoji--v" style="height:23px;width:auto;vertical-align:middle" title=":v:" alt="✌" /><img src="https://fusionauth.io/community/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f3fc.png?v=rcgg4tg866g" class="not-responsive emoji emoji-android emoji--skin-tone-3" style="height:23px;width:auto;vertical-align:middle" title=":skin-tone-3:" alt="🏼" /></p>
]]></description><link>https://fusionauth.io/community/forum/post/6649</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6649</guid><dc:creator><![CDATA[cody]]></dc:creator><pubDate>Wed, 04 Oct 2023 15:20:56 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Wed, 27 Sep 2023 18:08:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2022">@cody</a> A few more updates. I tried performing PKCE auth with the <code>Microsoft.AspNetCore.Components.WebAssembly.Authentication</code> nuget package, instead of <code>Microsoft.Authentication.WebAssembly.Msal</code>. It is also packaged with an <code>AuthenticationService.js</code> file, but it's a bit different than the equivalent file for the <code>Msal</code> package.</p>
<p dir="auto">It worked quite seamlessly when I tried the default WASM setup with Auth0, but had a long pause when using FusionAuth. I compared the two flows step for step. For FusionAuth, the app pauses until the iframe timeout is hit while attempting to do silent authentication, during which the application displays "Authorizing...". At first, this timeout was due to the <code>X-Frame-Options: Deny</code> header preventing the iframe from working at all. I wrote an nginx proxy config to remove that header, at which point the iframe showed up, but still hung until timeout.</p>
<p dir="auto">In the Auth0 flow, on successful authentication inside the iframe, the iframe posts a message containing the redirect uri with the querystring parameters containing the code, state, etc, which continues the flow in the application. FusionAuth's /authorize/oauth2 page never posts any such message, so the flow hangs.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6598</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6598</guid><dc:creator><![CDATA[cody]]></dc:creator><pubDate>Wed, 27 Sep 2023 18:08:06 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Wed, 27 Sep 2023 03:28:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2022">@cody</a> I got to the point of the WASM application hanging on "Completing login...", and spent some time tonight trying to figure out where things are going wrong. In my WASM project, I was using <code>Microsoft.Authentication.WebAssembly.Msal</code> instead of <code>Microsoft.AspNetCore.Components.WebAssembly.Authentication</code>, so maybe that was part of my problem to begin with. But none of this was obvious to me from the start, since initializing a Blazor WASM project set me up that way to begin with based on docs <a href="https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/standalone-with-microsoft-entra-id?view=aspnetcore-7.0" rel="nofollow ugc">here</a> saying to use this command:</p>
<p dir="auto"><code>dotnet new blazorwasm -au SingleOrg --client-id "{CLIENT ID}" -o {PROJECT NAME} --tenant-id "{TENANT ID}"</code></p>
<p dir="auto">Anyways, perhaps some of the following info may help someone else. I first turned on trace level logging in my <code>Program.cs</code> file:</p>
<p dir="auto"><code>builder.Logging.SetMinimumLevel(LogLevel.Trace);</code></p>
<p dir="auto">In Blazor WASM projects, the following script is added to the index.html file.</p>
<p dir="auto"><code>&lt;script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"&gt;&lt;/script&gt;</code></p>
<p dir="auto">I'm not sure how to find the original (TS, I would assume) source - it's embedded from Nuget somehow, but the doc specifying its addition to WASM is <a href="https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/standalone-with-microsoft-entra-id?view=aspnetcore-7.0" rel="nofollow ugc">here</a> - it is in the project by default if you initialize using the <code>dotnet new</code> command mentioned above. You can see a minified version of it in the Nuget package <a href="https://nuget.info/packages/Microsoft.Authentication.WebAssembly.Msal/7.0.11" rel="nofollow ugc">here</a> under the <code>staticwebassets</code> directory.</p>
<p dir="auto"><a href="https://gist.github.com/codyaweber/928d4ec6c82094c82e71605514fcbdad" rel="nofollow ugc">https://gist.github.com/codyaweber/928d4ec6c82094c82e71605514fcbdad</a></p>
<p dir="auto">After turning on trace logging, the following log shows up after coming back from the auth redirect to <code>/authentication/login-callback</code> with query string parameters containing the code, state, etc:</p>
<p dir="auto"><code>Verbose - Hash does not contain known properties, returning cached hash</code>.</p>
<p dir="auto">Hash? Apparently AAD puts the authorization code and other redirect parameters in the url hash instead of the querystring. There's some mention of this in this <a href="https://github.com/AzureAD/azure-activedirectory-library-for-js/issues/100" rel="nofollow ugc">github issue</a> where some others have run into trouble because of this.</p>
<p dir="auto">The FusionAuth redirect hash is empty because all the parameters are in the querystring, hence the error <code>Hash does not contain known properties</code>. I made several modifications to the AuthenticationService.js file to parse the querystring instead and see if it would work, but ran into one more error from the trace logs:</p>
<p dir="auto"><code>The client info was empty. Please review the trace to determine the root cause.</code>.</p>
<p dir="auto">In addition to the auth code querystring parameters that FusionAuth sends, I guess AAD also responds with a <code>client_info</code> parameter; I dunno what's even in it, but it's mentioned in <a href="https://learn.microsoft.com/en-us/javascript/api/@azure/msal-common/serverauthorizationcoderesponse?view=msal-js-latest" rel="nofollow ugc">the docs</a>. I just forced the value to <code>{}</code>, which fixed the problem, and resulted in a successful authentication. Granted, that was just the initial authentication. I have no idea if refreshing or anything would work after that.</p>
<p dir="auto">I'm sure someone else could figure out more than me here - I'm pretty new to dotnet. No idea how to proceed from all this information to a reasonable solution, but hopefully it helps someone else.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6592</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6592</guid><dc:creator><![CDATA[cody]]></dc:creator><pubDate>Wed, 27 Sep 2023 03:28:57 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Thu, 21 Sep 2023 21:10:34 GMT]]></title><description><![CDATA[<p dir="auto">Would love if this was something FusionAuth could improve on. I have auth flows for a number of SPAs in React set up, which work fairly well. But FusionAuth doesn't seem to work well with the standard Blazor WASM auth template, using PKCE and OIDC. That template works fine with other auth providers though - Okta, Azure AD, and Google were all basically plug and play. Plus Microsoft doesn't exactly make it easy to open up the hood and figure out what's going on, so I feel pretty stuck.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6583</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6583</guid><dc:creator><![CDATA[cody]]></dc:creator><pubDate>Thu, 21 Sep 2023 21:10:34 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Thu, 21 Sep 2023 12:23:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a> I'm also interested in using Fusion Auth in a .NET 7 Blazor application.  I went through similar steps shown in the thread and arrived at the same result.</p>
<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2595">@kern-markus</a> Did you ever get anything working, or did you go a different route?</p>
]]></description><link>https://fusionauth.io/community/forum/post/6582</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6582</guid><dc:creator><![CDATA[adamthole]]></dc:creator><pubDate>Thu, 21 Sep 2023 12:23:15 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Tue, 12 Sep 2023 04:13:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a></p>
<p dir="auto">Thank you!</p>
]]></description><link>https://fusionauth.io/community/forum/post/6538</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6538</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Tue, 12 Sep 2023 04:13:41 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Mon, 11 Sep 2023 20:30:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2595">@kern-markus</a> , my best guess at this point is that you are right in that it comes down to the way the request is sent and not having the expected headers to allow the CORS.  I don't see any open issues for FusionAuth that may implement the suggested changes and I am not aware of a workaround other than to change the technology used for the application or insert some sort of proxy that can add the appropriate headers.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6532</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6532</guid><dc:creator><![CDATA[mark.robustelli]]></dc:creator><pubDate>Mon, 11 Sep 2023 20:30:47 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Mon, 11 Sep 2023 04:29:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a></p>
<p dir="auto">Here's my current settings and code:</p>
<pre><code>"FusionAuth": {
  "Authority": "http://localhost:9011/",
  "ClientId": "[id]",
  "ClientSecret": "[secret]",
  "RedirectUri": "https://localhost:7281/authentication/login-callback",
  "PostLogoutRedirectUri": "https://localhost:7281/authentication/logout-callback",
  "ResponseType": "code"
},
</code></pre>
<pre><code>builder.Services
    .AddOidcAuthentication(options =&gt;
    {
        builder.Configuration.Bind("FusionAuth", options.ProviderOptions);
        options.ProviderOptions.DefaultScopes.Add("openid");
    });
</code></pre>
]]></description><link>https://fusionauth.io/community/forum/post/6531</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6531</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Mon, 11 Sep 2023 04:29:04 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Mon, 11 Sep 2023 04:25:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a></p>
<p dir="auto">Thank you.<br />
I came a step further than that. I get logged in but get the error message I described above:<br />
<em>Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.</em></p>
<p dir="auto"><img src="/community/forum/assets/uploads/files/1694406322360-screenshot-2023-09-11-062331.png" alt="Screenshot 2023-09-11 062331.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">And when I googled around a bit more I came to the stackoverflow thread I linked in my last post before this one, which I understand to tell me that there is no way around this problem unless FusionAuth makes changes to CORS settings on your side.<br />
So what I need now is basically a confirm of this or an explanation of how to get around that particular problem.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6530</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6530</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Mon, 11 Sep 2023 04:25:25 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Fri, 08 Sep 2023 20:57:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2595">@kern-markus</a>, After spending far to long with this issue <img src="https://fusionauth.io/community/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=rcgg4tg866g" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /> I was able to get the full page redirect to re-route to FusionAuth, allow me to login, and the send be back to the sample app.  The app seems to get stuck on 'Completing login...' however.  I'm not sure what that is about, but I can see in the URL that the login has occurred.</p>
<pre><code>https://localhost:7055/authentication/login-callback#locale=en&amp;scope=openid+profile&amp;state=7cb3f5fc78db4d27b679d45ba415fc5c&amp;userState=Authenticated&amp;id_token=eyJhbGciOiJI....
</code></pre>
<p dir="auto">I think this has to do with the WASM app rather than fusion AUTH at this point.  Are you at least able to make it that far?</p>
<p dir="auto"><img src="/community/forum/assets/uploads/files/1694206619405-screenshot-2023-09-08-at-1.55.53-pm.png" alt="Screenshot 2023-09-08 at 1.55.53 PM.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://fusionauth.io/community/forum/post/6527</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6527</guid><dc:creator><![CDATA[mark.robustelli]]></dc:creator><pubDate>Fri, 08 Sep 2023 20:57:54 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Thu, 07 Sep 2023 14:31:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2595">@kern-markus</a> in the above, with the steps to reproduce, can you have share what you have in your builder.Services.AddOidcAuthentication function?  Please remember to replace any sensitive information before sharing for things like client secret or anything of that nature.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6521</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6521</guid><dc:creator><![CDATA[mark.robustelli]]></dc:creator><pubDate>Thu, 07 Sep 2023 14:31:33 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Thu, 07 Sep 2023 05:17:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a></p>
<p dir="auto">So. I <em>think</em> I have an understanding of the actual issue now. After reading this post on Stack Overflow:</p>
<p dir="auto"><a href="https://stackoverflow.com/a/65859787" rel="nofollow ugc">https://stackoverflow.com/a/65859787</a></p>
<p dir="auto">It seems to me that there is a CORS setting that is needed on the FusionAuth API side if it is going to work with Blazor WebAssembly at all, and that setting is not currently available in configuration?<br />
So if I understand correctly, if we want to get FusionAuth to work with our Blazor solution, the only available option is a workaround: to implement authorization in our API instead.</p>
<p dir="auto">Can you confirm this? We need to get working on the workaround ASAP in that case, so a quick confirm and an indication to the right sample code would be very valuable.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6519</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6519</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Thu, 07 Sep 2023 05:17:07 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Thu, 07 Sep 2023 04:41:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a></p>
<p dir="auto">Ah, yes, it's this error that I have seen mentioned in the threads before:</p>
<p dir="auto">Access to XMLHttpRequest at '<a href="http://localhost:9011/oauth2/userinfo" rel="nofollow ugc">http://localhost:9011/oauth2/userinfo</a>' from origin '<a href="https://localhost:7281" rel="nofollow ugc">https://localhost:7281</a>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.</p>
<p dir="auto">Is there a way to get around this problem? This seems to be the real stumbling block people have had if I understand correctly?</p>
]]></description><link>https://fusionauth.io/community/forum/post/6518</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6518</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Thu, 07 Sep 2023 04:41:40 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Thu, 07 Sep 2023 04:36:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a><br />
Thanks for getting back in touch! I am also back on this problem just now.<br />
I have got the authorization step working with this CORS setting:<br />
<img src="/community/forum/assets/uploads/files/1694061122747-screenshot-2023-09-07-062930.png" alt="Screenshot 2023-09-07 062930.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">However, something doesn't work on the redirect back. I get 'There was an error signing in', even though I get a response with a token. I am troubleshooting this right now.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6517</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6517</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Thu, 07 Sep 2023 04:36:44 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Wed, 06 Sep 2023 14:28:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2595">@kern-markus</a> Sorry, I haven't had a chance to test this out yet.  I hope to get to some time later this week.  I will let you know what I find.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6515</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6515</guid><dc:creator><![CDATA[mark.robustelli]]></dc:creator><pubDate>Wed, 06 Sep 2023 14:28:56 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Mon, 04 Sep 2023 06:42:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2595">@kern-markus</a><br />
<a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a><br />
<a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/371">@ethalacker</a><br />
<a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/3">@robotdan</a></p>
<p dir="auto">Any progress on this? Is it possible that a workaround with some inserted javascript would help?</p>
]]></description><link>https://fusionauth.io/community/forum/post/6509</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6509</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Mon, 04 Sep 2023 06:42:57 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Thu, 31 Aug 2023 04:14:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a><br />
Any new insights?<br />
Best regards<br />
Markus</p>
]]></description><link>https://fusionauth.io/community/forum/post/6500</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6500</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Thu, 31 Aug 2023 04:14:06 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Mon, 28 Aug 2023 04:34:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2507">@mark-robustelli</a></p>
<p dir="auto">Thank you!<br />
That should be correct yes, except I am using <strong>.Net 7</strong>.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6481</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6481</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Mon, 28 Aug 2023 04:34:42 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Wed, 23 Aug 2023 14:28:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2595">@kern-markus</a>  Hello.  Are these still the right steps to replicate your specific issue?</p>
<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/371">@ethalacker</a> said in <a href="/community/forum/post/1667">Blazor WASM auth</a>:</p>
<blockquote>
<p dir="auto">To Replicate</p>
<p dir="auto">Use the new .NET 5 sdk.<br />
dotnet new blazorwasm -au Individual -o BlazorAuthSample5 in the CLI/powershell<br />
copy my Program.cs into yours. Only a few lines added/replaced.<br />
change wwwroot/appsettings.json to include your fusionAuth clientId<br />
dotnet run on folder and try to login</p>
</blockquote>
<p dir="auto">Is there anything else you want to add?  Once I get confirmation, I will try to recreate on my end.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6462</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6462</guid><dc:creator><![CDATA[mark.robustelli]]></dc:creator><pubDate>Wed, 23 Aug 2023 14:28:49 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Wed, 23 Aug 2023 05:21:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2595">@kern-markus</a><br />
<a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/3">@robotdan</a><br />
<a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/371">@ethalacker</a></p>
<p dir="auto">Hello. I have the same problem.<br />
I am trying to make a local FusionAuth work with a .Net 7 Blazor WebAssembly project.</p>
<p dir="auto">I have the following settings:</p>
<pre><code>"FusionAuth": {
  "Authority": "http://localhost:9011/",
  "ClientId": "dc0ea808-5644-42af-b8de-718a71683959",
  "ClientSecret": "gKqlvcI8TB5qJi89rNksKbrOOWbVx5UE0FNLBPc2AEI",
  "RedirectUri": "https://localhost:7281/authentication/login-callback",
  "PostLogoutRedirectUri": "https://localhost:7281/authentication/logout-callback",
  "ResponseType": "code"
}
</code></pre>
<p dir="auto"><img src="/community/forum/assets/uploads/files/1692768057587-fusionauth-resized.jpg" alt="fusionauth.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">I get:</p>
<p dir="auto"><strong>Access to XMLHttpRequest at '<a href="http://localhost:9011/.well-known/openid-configuration" rel="nofollow ugc">http://localhost:9011/.well-known/openid-configuration</a>' from origin '<a href="https://localhost:7281" rel="nofollow ugc">https://localhost:7281</a>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.</strong></p>
<p dir="auto">I have previously managed to make my local FusionAuth work with the MVC sample project.<br />
Could I please get some guidance as to what to do about this?</p>
]]></description><link>https://fusionauth.io/community/forum/post/6460</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6460</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Wed, 23 Aug 2023 05:21:25 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Thu, 17 Aug 2023 06:57:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/409">@jphelps</a> <a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/20">@dan</a> <a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/371">@ethalacker</a><br />
I am currently struggling with the same scenario. How did you actually get it to work? Could you put it up as a sample project perhaps?</p>
]]></description><link>https://fusionauth.io/community/forum/post/6447</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6447</guid><dc:creator><![CDATA[kern.markus]]></dc:creator><pubDate>Thu, 17 Aug 2023 06:57:34 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Mon, 23 Nov 2020 16:41:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/409">@jphelps</a> said in <a href="/community/forum/post/1726">Blazor WASM auth</a>:</p>
<blockquote>
<p dir="auto">Sec-Fetch-Dest</p>
</blockquote>
<p dir="auto">We do not currently do anything with the <code>Sec-Fetch-Dest</code> header. This header doesn't look to be a widely supported, and even if we did look at this header, I don't understand how this would help. Doesn't this header just indicate the intended use?</p>
<p dir="auto">Is this a test setup, or do you plan to run this all on <code>localhost</code> in production as well? I would assume that if the <code>fetch</code> request thought it was making a request to a different host it may add the <code>Origin</code> header?</p>
<p dir="auto">I don't know what this means yet but in section <a href="https://fetch.spec.whatwg.org/#origin-header" rel="nofollow ugc">3.1</a> fo the Fetch spec it says the <code>Origin</code> header is not included in all fetches. I couldn't find any specific scenarios spelled out where it won't be sent.</p>
<blockquote>
<p dir="auto">The <code>Origin</code> header is a version of the <code>Referer</code> [sic] header that does not reveal a path. It is used for all HTTP fetches whose request’s response tainting is "cors", as well as those where request’s method is neither <code>GET</code> nor <code>HEAD</code>. Due to compatibility constraints it is not included in all fetches.</p>
</blockquote>
<p dir="auto">Regarding your question,</p>
<blockquote>
<p dir="auto">What I do find a bit confusing is the following. Why does Fusion Auth return the full login page html with an X-Frame-Options header with DENY, if it can see Sec-Fetch-Dest header is iframe and there is not a Origin header to check against the Authorized request origin URLs . It would make more sense to me to return a 302 redirect to the application login callback.</p>
</blockquote>
<p dir="auto">I suppose this is an option, in general we prefer to fail in such a way that it indicates something is wrong. If we redirect w/out a failure - the developer may not know there is a configuration error.</p>
<p dir="auto">How would returning <code>302</code> assist you in your integration?</p>
]]></description><link>https://fusionauth.io/community/forum/post/1763</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/1763</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Mon, 23 Nov 2020 16:41:18 GMT</pubDate></item><item><title><![CDATA[Reply to Blazor WASM auth on Wed, 18 Nov 2020 18:57:44 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for your help and responses <a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/3">@robotdan</a>!</p>
<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/371">@ethalacker</a> and I have been going over this and we believe we understand why things are working the way they are.</p>
<p dir="auto">The Origin header is not being sent by the Blazor authentication system which is based on <a href="https://github.com/IdentityModel/oidc-client-js" rel="nofollow ugc">odic-client.js</a>.  Since the requests are coming from ajax/XHR and the <code>Sec-Fetch-Mode</code> header is <code>navigate</code>, the browser will not include the <code>Origin</code> header according to the <a href="https://fetch.spec.whatwg.org/#main-fetch" rel="nofollow ugc">Fetch API</a>.  Thus there is not a header for Fusion Auth to check.</p>
<p dir="auto">What I do find a bit confusing is the following.  Why does Fusion Auth return the full login page html with an <code>X-Frame-Options</code> header with <code>DENY</code>, if it can see <code>Sec-Fetch-Dest</code> header is <code>iframe</code> and there is not a <code>Origin</code> header to check against the <code>Authorized request origin URLs</code> .  It would make more sense to me to return a <code>302 redirect</code> to the application login callback.</p>
<p dir="auto">We have tested our application against several oidc providers, and the other providers do a <code>302 redirect</code> to the application login callback.</p>
]]></description><link>https://fusionauth.io/community/forum/post/1726</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/1726</guid><dc:creator><![CDATA[jphelps]]></dc:creator><pubDate>Wed, 18 Nov 2020 18:57:44 GMT</pubDate></item></channel></rss>