Basu
Basu

Reputation: 11

Can we replace Local Storage with Cookies to store Tokens in NGRX based authentication?

Auth Module.ts

I would like to replace the local storage with cookies, can it be done ?

import { localStorageSync } from 'ngrx-store-localstorage';

const localStorageRules = {
  keys: [
    { auth: { deserialize: AuthState.deserialize } }
  ],
  rehydrate: true,
  storage: sessionStorage
};

export function localStorageSyncWrapper(reducer: any) {
  return localStorageSync(localStorageRules)(reducer);
}

Upvotes: 1

Views: 933

Answers (1)

Dako patel
Dako patel

Reputation: 920

you can install ngx-cookie-service for cookie store or remove or get..

for more information about npm pakage ngx-cookie-service

Upvotes: 1

Related Questions