GregHouse
GregHouse

Reputation: 315

Auth0 and localStorage

In the Auth0 quickstart for Angular2, the code accesses local storage via the following example:

localStorage.setItem('id_token', authResult.idToken);

localStorage resolves to type Storage.

I don't see where this is defined in the example but it does work. Can anyone tell me why this works?

Upvotes: 0

Views: 453

Answers (1)

Poul Kruijt
Poul Kruijt

Reputation: 71931

localStorage is a default property on the window object. And Storage is a standard JavaScript object, so no import is necessary.:

https://developer.mozilla.org/en/docs/Web/API/Window/localStorage

This applies to IE>=8

Upvotes: 2

Related Questions