phenomnomnominal / angular-2-local-storage

LocalStorageService for Angular 2 with the same API as angular-local-storage
MIT License
93 stars 49 forks source link

Question: localstorage in a Angular2 Service #38

Open wlafrance opened 7 years ago

wlafrance commented 7 years ago

I am trying to get the local storage to persist some auth token info, and it is occurring in a service. Strangly enough it does not seem to want to persist. If I redirect to the auth middleware (IdentityServer3) and then redirect back to the original site, the data I persisted is not there anymore. Is there something special I need to do to get localstorage to work for a service?

elwynelwyn commented 7 years ago

Did you add the LocalStorageModule at the root of your application? And did you set the storageType config option? If you put a breakpoint in your code after it stores the auth token, before it redirects off somewhere else, can you see your value stored in localStorage correctly?