angular-2-local-storage icon indicating copy to clipboard operation
angular-2-local-storage copied to clipboard

Question: localstorage in a Angular2 Service

Open wlafrance opened this issue 8 years ago • 1 comments

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?

wlafrance avatar Mar 30 '17 12:03 wlafrance

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?

elwynelwyn avatar Mar 30 '17 19:03 elwynelwyn