Skip to content

Instantly share code, notes, and snippets.

@jeroenheijmans
Created June 13, 2018 11:18
Show Gist options
  • Save jeroenheijmans/9ca9c710b96487454b2e01c7537eecca to your computer and use it in GitHub Desktop.
Save jeroenheijmans/9ca9c710b96487454b2e01c7537eecca to your computer and use it in GitHub Desktop.
OAuthStorage wrapper for debugging angular-oauth2-oidc library
// Usage:
// { provide: OAuthStorage, useValue: decoratedStorage },
const decoratedStorage: OAuthStorage = {
getItem(key) {
const data = localStorage.getItem(key);
console.warn('get', key, data ? data.substring(0, 25) : data);
return data;
},
setItem(key, data) {
console.warn('set', key, data ? data.substring(0, 25) : data);
return localStorage.setItem(key, data);
},
removeItem(key) {
console.warn('remove', key);
return localStorage.removeItem(key);
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment