Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve prerendering and authentication experience in Blazor #27592

Closed
captainsafia opened this issue Nov 6, 2020 · 19 comments
Closed

Improve prerendering and authentication experience in Blazor #27592

captainsafia opened this issue Nov 6, 2020 · 19 comments
Assignees
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components design-proposal This issue represents a design proposal for a different issue, linked in the description enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-blazor-wasm-auth Pillar: Technical Debt Priority:1 Work that is critical for the release, but we could probably ship without severity-major This label is used by an internal tool

Comments

@captainsafia
Copy link
Member

captainsafia commented Nov 6, 2020

Enabling pre-rendering on a Blazor WASM app with authentication is difficult.

Related issues:

@captainsafia captainsafia added enhancement This issue represents an ask for new feature or an enhancement to an existing one design-proposal This issue represents a design proposal for a different issue, linked in the description affected-few This issue impacts only small number of customers severity-major This label is used by an internal tool labels Nov 6, 2020
@Pilchie Pilchie added the area-blazor Includes: Blazor, Razor Components label Nov 9, 2020
@captainsafia captainsafia added this to the Next sprint planning milestone Nov 11, 2020
@ghost
Copy link

ghost commented Nov 11, 2020

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@javiercn javiercn added feature-blazor-wasm-auth feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Apr 20, 2021
@javiercn
Copy link
Member

@captainsafia this is a dupe of #29634 feel free to close one or the other.

This has a combined 15 upvotes

@captainsafia
Copy link
Member Author

Ah, I see. I'll close the other one since it's newer.

@mkArtakMSFT mkArtakMSFT changed the title Improve pre-rendering and authentication experience in Blazor Improve prerendering and authentication experience in Blazor Jul 20, 2021
@ghost
Copy link

ghost commented Jul 20, 2021

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@ChristianWeyer
Copy link

Does this mean we cannot use pre-rendering with SPA authN flows in a feasible and reasonable way?
This renders (pun intended ;-) ) this features unusable @captainsafia.

Thanks!

@javiercn
Copy link
Member

We are grooming our backlog and we don't think this issue will make the cut, while painful, there are ways around it (even if not trivial)

We might reconsider this one if we get time, however is not a trivial issue and requires design, which why we are hesitant about tackling it now, (hence the backlog)

@ChristianWeyer
Copy link

ChristianWeyer commented Jul 20, 2021

Hi @javiercn - thanks for answering.
It would help a lot if you would show people the ways around it :-)

Thanks.

@javiercn
Copy link
Member

@ChristianWeyer I believe there are some docs about it, but in general involves skipping prerendering over any url that might require auth, which is why it is so painful.

@ChristianWeyer
Copy link

Which in reality renders it unusable, sorry. been there, done that :-)

@keerthirajap
Copy link

I temporarily resolved by using prerender.io

#39137 (comment)

@javiercn javiercn modified the milestones: 7.0-preview7, 7.0-rc1 Jul 18, 2022
@cirrusone
Copy link

May I ask if this issue is likely to help with seamless switching between Blazor Server and Blazor WebAssembly at runtime whilst authenticated?

The AllinOne sample here https://github.com/ShaunCurtis/AllinOne is an excellent example which switches between Blazor modes but when attempting to add authentication lots of issues arise that prevent authentication state being recognized.

I would like to
1/ Start with Blazor Server and require login to standard ASP.NET Core Identity using cookies
2/ Blazor Server can pre-fetch the WASM assets after server side loaded whilst user is logging in.
Eg

    <script>
        window.addEventListener('load', () => {
            fetch('/wasm/_framework/dotnet.wasm')
            fetch('/wasm/_framework/blazor.webassembly.js');
            fetch('/wasm/_framework/blazor.boot.json');
        });
    </script>

3/ Once authenticated on Server, user can seamlessly switch to Blazor WASM which maintains authenticated state on both Blazor Server and Blazor WebAssembly

Is something like this currently possible and/or will this be possible in the near future?

@javiercn
Copy link
Member

May I ask if this issue is likely to help with seamless switching between Blazor Server and Blazor WebAssembly at runtime whilst authenticated?

No. This will only help with prerendering Blazor Webassembly applications or Blazor Server applications, but not switching between the two at runtime. That is not a scenario we currently support

@yugabe
Copy link

yugabe commented Sep 2, 2022

Hey all! It's been a while since this issue first surfaced, and it seems it's still on the way for .NET 7. Can someone please confirm?

I also don't quite understand how this is supposed to work when:

  • Not using cookies: on a full postback, only the cookies are a native solution for the server to identify the user by as the Blazor WASM app hasn't started that sends AJAX requests with additional headers instead of cookies. What is the proposed scenario? When using tokens, the app won't try to prerender components that require authentication?
  • Using cookies: this should be essentially working out of the box; if the cookies are present, they should be available both during prerendering and when the client sends AJAX requests to the API.

So is the proposed change here to disallow prerendering when it's tied to authentication? Hopefully there will be a way to opt-out of this behavior, as it'll quite possibly break already working prerender+auth solutions.

Thanks!

@javiercn javiercn modified the milestones: 7.0-rc2, 7.0.0 Sep 7, 2022
@mkArtakMSFT mkArtakMSFT modified the milestones: 7.0.0, 8.0-preview1 Oct 12, 2022
@ghost
Copy link

ghost commented Nov 29, 2022

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@modigithub
Copy link

Ok, is there a site where you can vote? I think that is an extremely important part. Without pre-rendering with authentication-dependent content, many projects fail. I would like to advocate that it be integrated into the planning for .net 8. However, I didn't quite understand what "it's very rare and low-impact issue, we will close it" means. Do you think that in this ticket the people have to participate? Or is there a voting page as mentioned above?

I'm very excited about blazor. However, the initial loading time and the loading symbol right at the beginning of a page is a no-go for me. The prerendering would solve exactly these problems and would be a reason for me to only do all my projects with Blazor WASM.

@chassq
Copy link
Contributor

chassq commented Jan 30, 2023

Any good way to get involved other than responding to this issue? This needs a resolution in order for Blazor Wasm to be usable in the near and far future. Pre-rendering and Authentication need to play well together. Also, we need to be able to have a well-documented method for pre-rending wasm without a Host site. Can it be built so that, for example, pre-rendering is done for bots/facebook posts, etc. and not "user" requests?

@ChristianWeyer
Copy link

Hi @captainsafia - could you please update us on where we are with this feature? This is still a very important part of using Blazor WASM in the 'real world' :-)

Thank you!

@ghost
Copy link

ghost commented Oct 6, 2023

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@mkArtakMSFT
Copy link
Member

A lot of the initial pain points have been addressed during .NET 8 in this space. The remaining work here is to simply passing authentication state from server to client which we will address as part of #52769

@ghost ghost locked as resolved and limited conversation to collaborators Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components design-proposal This issue represents a design proposal for a different issue, linked in the description enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-blazor-wasm-auth Pillar: Technical Debt Priority:1 Work that is critical for the release, but we could probably ship without severity-major This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests