using angualr $window.document in token storage