FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login
    1. Home
    2. kern.markus
    K
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 11
    • Best 1
    • Controversial 0
    • Groups 0

    kern.markus

    @kern.markus

    1
    Reputation
    1
    Profile views
    11
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    kern.markus Unfollow Follow

    Best posts made by kern.markus

    • RE: Blazor WASM auth

      @mark-robustelli

      Thank you!
      That should be correct yes, except I am using .Net 7.

      posted in Q&A
      K
      kern.markus

    Latest posts made by kern.markus

    • RE: Blazor WASM auth

      @mark-robustelli

      Thank you!

      posted in Q&A
      K
      kern.markus
    • RE: Blazor WASM auth

      @mark-robustelli

      Here's my current settings and 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"
      },
      
      builder.Services
          .AddOidcAuthentication(options =>
          {
              builder.Configuration.Bind("FusionAuth", options.ProviderOptions);
              options.ProviderOptions.DefaultScopes.Add("openid");
          });
      
      posted in Q&A
      K
      kern.markus
    • RE: Blazor WASM auth

      @mark-robustelli

      Thank you.
      I came a step further than that. I get logged in but get the error message I described above:
      Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

      Screenshot 2023-09-11 062331.png

      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.
      So what I need now is basically a confirm of this or an explanation of how to get around that particular problem.

      posted in Q&A
      K
      kern.markus
    • RE: Blazor WASM auth

      @mark-robustelli

      So. I think I have an understanding of the actual issue now. After reading this post on Stack Overflow:

      https://stackoverflow.com/a/65859787

      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?
      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.

      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.

      posted in Q&A
      K
      kern.markus
    • RE: Blazor WASM auth

      @mark-robustelli

      Ah, yes, it's this error that I have seen mentioned in the threads before:

      Access to XMLHttpRequest at 'http://localhost:9011/oauth2/userinfo' from origin 'https://localhost:7281' 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.

      Is there a way to get around this problem? This seems to be the real stumbling block people have had if I understand correctly?

      posted in Q&A
      K
      kern.markus
    • RE: Blazor WASM auth

      @mark-robustelli
      Thanks for getting back in touch! I am also back on this problem just now.
      I have got the authorization step working with this CORS setting:
      Screenshot 2023-09-07 062930.png

      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.

      posted in Q&A
      K
      kern.markus
    • RE: Blazor WASM auth

      @kern-markus
      @mark-robustelli
      @ethalacker
      @robotdan

      Any progress on this? Is it possible that a workaround with some inserted javascript would help?

      posted in Q&A
      K
      kern.markus
    • RE: Blazor WASM auth

      @mark-robustelli
      Any new insights?
      Best regards
      Markus

      posted in Q&A
      K
      kern.markus
    • RE: Blazor WASM auth

      @mark-robustelli

      Thank you!
      That should be correct yes, except I am using .Net 7.

      posted in Q&A
      K
      kern.markus
    • RE: Blazor WASM auth

      @kern-markus
      @robotdan
      @ethalacker

      Hello. I have the same problem.
      I am trying to make a local FusionAuth work with a .Net 7 Blazor WebAssembly project.

      I have the following settings:

      "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"
      }
      

      fusionauth.jpg

      I get:

      Access to XMLHttpRequest at 'http://localhost:9011/.well-known/openid-configuration' from origin 'https://localhost:7281' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

      I have previously managed to make my local FusionAuth work with the MVC sample project.
      Could I please get some guidance as to what to do about this?

      posted in Q&A
      K
      kern.markus