You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wanting to use the users session in my nightmare instance, to generate a pdf.
Is it possible to somehow push the express session for the request into the nightmare instance when initialized? #398 seemed like it might have been relevant but not sure how to use those suggestions towards what I need.
The text was updated successfully, but these errors were encountered:
The short answer: possibly, but it would require a lot of effort and (probably frustrating) experimentation, and I suspect whatever implementation you came up with would be flaky at best. #398 (I believe) is more at sharing sessions across Nightmare instances, possibly across machines.
A slightly longer answer: I also suspect based on what you said that you're doing this on the server where the Express instance lives. If that's the case, you already have access to the user session, consequently the information you need, and can build the HTML required for the PDF there. That buys you a couple of options off the top of my head:
Expose a new unauthenticated web method that examines the headers for a unique key, then have Nightmare add the key to the headers for the request. Not exactly the most secure option, but it would work.
Use the same approach as option 1, but in a different service that isn't publicly exposed.
Write the HTML to disk in a temporary file, and point Nightmare to that file.
Thanks for your feedback. Yeah, my inclination is that it would be quite hacky. I'm not super familiar with sessions but it sort of seems like it goes against the core of what sessions are for.
I had already implemented what you suggested as point 2, so I'll probably just roll with that.
I'm wanting to use the users session in my nightmare instance, to generate a pdf.
Is it possible to somehow push the express session for the request into the nightmare instance when initialized?
#398 seemed like it might have been relevant but not sure how to use those suggestions towards what I need.
The text was updated successfully, but these errors were encountered: