I need to store a refresh-token in memory in an Angular (Javascript) application.
The token will be delivered via an Ajax call upon authentication and then needs to be stored in memory until the user logs off or closes the browser.
I now want to know how I can keep this token safely in memory so it cannot be extracted by console access or a malicious browser plugin which has access to the webpage.
I found some other thread on how to use refresh-tokens in angular but I think the implementation is not safe:
AngularJS - http interceptor - resend all request after token refresh
Would it be safe if I replaced the authService with a private object to store the refresh- and access-token?