My answer is perhaps a bit naive, but why not store the token in the persistence store of your browser. If you are using Angular, with the code described below:
function((...), $window) {
(...)
$window.sessionStorage['userToken'] = '<user-token>';
}
I do not see other approaches (exception cookies) to keep such prompts when the browser page is closed.
The problem with cookies is that your client must be a browser in order to use this feature transparently ... Also, this is really not the best approach for authentication in RESTful services; -)
, : https://templth.wordpress.com/2015/01/05/implementing-authentication-with-tokens-for-restful-applications/.
, JS, Angular, XSS. . , :
, ,
Thierry