title: Storing Refresh Token In JavaScript, Getting New Access Token
body: <p>I have a ASP.NET Web API that returns an OAuth2 bearer token upon login.  I plan to store the refresh token in a cookie via JavaScript.  Where in my JS should I check if the access token is expired to fetch a new one...right before each subsequent API call that requires authentication or on some sort of timer loop?  This will be an async web app, so I didn't think a timer loop would be ideal.  Any ideas?</p>