The token caching in Powershell is completely internal to the ADAL library; all we do is provide an implementation of IDictionary and ADAL does the rest, including retrieval. So there's not much there to factor out. I suspect if we get an adal.js they'll come up with a similar design.