Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Prerendered SPA cookies issues #66

Closed

Description

@laskoviymishka

When we have spa running under server authorization context (i.e. we have cookies authorization) we no able to run secure API calls on prerendering side.
For angular this is blocked till issue: angular/universal#273 resolved
For react (react-redux template) this not working for both client and server render (isomorphic search not passing cookies), but could be fixed.

Activity

  1. laskoviymishka commented on May 9, 2016

    @laskoviymishka
    ContributorAuthor

    To enabling server side cookies processing we need to path the cookie string or object from server request to JS module invoke. Currently we can do this by adding additional arg to method:

    public static async Task<RenderToStringResult> RenderToString
    

    This method further pass it throw chosen workflow (specific node services) and prepare context object which be accessible in JS rendered module.
    This is quite simple feature (from server side perspective), so i could create it.
    For the client side modification (template for ng2 still blocked, react template need some deep refactoring), better to create separate issues.

  2. added a commit that references this issue on Jun 1, 2016
    b17b79d
  3. SteveSandersonMS commented on Jun 14, 2016

    @SteveSandersonMS
    Member

    If I understand correctly, the basic thing missing from NodeServices here is the ability to pass through additional arbitrary information from the asp-prerender-* tag helpers into the JS boot function. If that facility existed, you could pass through whatever authentication information was relevant to your application, which might be:

    • The authenticated username, if you're using ASP.NET auth
    • A JWT token or similar, if you're using some external auth mechanism
    • Some information from the user's Session store, if you have some custom auth system or need to pass through something like "what features this user has paid for" etc.

    Do you agree?

    Closing this in favour of the more general #107

  4. laskoviymishka commented on Jun 14, 2016

    @laskoviymishka
    ContributorAuthor

    @SteveSandersonMS not really, it mean that we have no ability to operate with request cookies in prerender process. If you have regular MVC cookies auth, and you try to fetch secure resource it will work on client, but fail on server render. This issues simillar but have really different background. This behaivior should populated by default.
    Cookies could contain a lot of useful information that used by client side. Without them server prerender lose a lot of efficient.

  5. laskoviymishka commented on Jun 14, 2016

    @laskoviymishka
    ContributorAuthor

    JWT token is impossible in server render process (it obvious couse we don't have no connect to any client storage at server).
    Sessing and cookies could be passed as asp-prerender-model but is it really best option?

  6. SteveSandersonMS commented on Jun 14, 2016

    @SteveSandersonMS
    Member

    I understand you are looking for specific cookie support, rather than relying on the developer to pass through the information manually. Filed #130 to track that.

  7. jeinz11 commented on May 28, 2017

    @jeinz11

    I need this feature badly because im using mvc cookie authentication....
    please help

  8. jeinz11 commented on May 28, 2017

    @jeinz11

    Cookie support please

  9. jeinz11 commented on May 29, 2017

    @jeinz11

    @laskoviymishka hi can i use this right now?

     public static async Task<RenderToStringResult> RenderToString
    

    and pass args with cookies please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions