Open stephanegg opened 6 years ago
Is not it possible to store a cookie for your access token, and accessing it from the server, and browser?
You just need to check the platform, and use the correct way to access cookies based on platform type
LocalStorage is not available server side. You have to store your auth token into cookies.
Sure, do you have any example on how to send the auth cookie on browser side and get it back server side? It would be really helpful (for me and a lot of people I think as it s not really well documented)
I am also struggling with this issue and I have problems with these parts:
I tried to use @Inject(REQUEST)
but gave me a an error.
I would also need a way to delete the cookie if the authentication expires.
ngx-cookie good work with SSR look https://github.com/Angular-RU/angular-universal-starter/blob/master/src/app/home/home.component.ts#L21
@canbakis hope this helps https://github.com/angular/universal-starter/issues/373#issuecomment-527021529
Angular Universal allows us to store auth token on the client side (in the localstorage wrapped in isPlatformBrowser condition) but how to retrieve it on the server side? What are the best practices? I guess that using Http Interceptor is key but what is left is still unclear for me.