Angular 7 Cookie for SSR (universal)

Issue

I’m trying to implement SSR for my angular app. I followed the universal starter guide (https://angular.io/guide/universal).

My angular app consumes a rest API which need an access_token (client_credentials grant_type) for all requests. Im using cookies to store it on the client side.

I know that cookies can’t work from scratch on the server side. So i tried some packages (ngx-cookie-service) but i can’t find one for SSR and angular 7…

Lately i found this package (ngx-auth) but i’m not sure i can use it for that purpose…

I can’t find any documentation on the universal website, if someone have successfully implemented cookies for universal using angular 7…

A big thanks !

Solution

Ok i finally succeed using @gorniv/ngx-universal, following https://github.com/Angular-RU/angular-universal-starter

If needed i can provide an implementation example with angular 9.

Answered By – lovis91

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published