To check authentication status:
platform.isAuthorized()
.then(function(){ ... })
.catch(function(e){ ... });
The isAuthorized method will automatically perform a refresh of the access token, if needed. This method may be used in the login page of your application for automatic login.
There is also a synchronous method for checking the authentication status that does not automatically perform a refresh of the access token.
if (platform.isTokenValid()) {...}
Access token refresh normally happens automatically for common use cases. On rare occasions, you may perform a refresh of the access token manually by calling the refresh method, as follows:
platform.refresh().then(...)