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
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
I'm working on my first react + redux application and got everything working so far with windows authentication. I passed the 'same-origin' value to the credentials parameter in fetch() and it's working as intended.
The only problem is that SSR isn't working on a page that has to initially make some api calls, I can't really figure out a solution so that's why I'm asking for help.
I'm using the default React + Redux template with IIS Express windows authentication enabled.
Using this technique, you can pass whatever authentication credentials or token you have in .NET code to boot-server.ts, and use that whenever you call fetch. For example, you could take an auth token from some incoming HTTP header in .NET code, and send the same HTTP header when you make fetch calls.
I know this is not trivial to implement. The reason there's no built-in feature for replaying auth tokens like that is that it would be a huge security issue if your app was calling third-party APIs (unless you take steps to control exactly whichfetch calls get the auth context, you might be leaking credentials to third parties).
Activity
SteveSandersonMS commentedon Mar 7, 2017
When you're doing server-side prerendering, you can pass arbitrary (JSON-serializable) data from .NET into your
boot-server.tscode. To do this, see Passing data from .NET code into JavaScript code on this page of docs: https://github.com/aspnet/JavaScriptServices/blob/dev/src/Microsoft.AspNetCore.SpaServices/README.mdUsing this technique, you can pass whatever authentication credentials or token you have in .NET code to
boot-server.ts, and use that whenever you callfetch. For example, you could take an auth token from some incoming HTTP header in .NET code, and send the same HTTP header when you makefetchcalls.I know this is not trivial to implement. The reason there's no built-in feature for replaying auth tokens like that is that it would be a huge security issue if your app was calling third-party APIs (unless you take steps to control exactly which
fetchcalls get the auth context, you might be leaking credentials to third parties).jeinz11 commentedon May 30, 2017
hi @SteveSandersonMS i passed my cookies in the globals but i cant retrieve it inside my reducer
so no way plugging it in our fetch request