Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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