Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 7 Cookie for SSR (universal)

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 !

like image 220
lovis91 Avatar asked Feb 06 '19 17:02

lovis91


1 Answers

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.

like image 82
lovis91 Avatar answered Oct 18 '22 13:10

lovis91