I am new to using Google APIs. I followed steps to setup Google Calendar sample code in eclipse using Google client library. I deployed the code to app engine using the cmd
In order to receive a refresh token, you need to have access_type=offline in the authorization request: https://developers.google.com/accounts/docs/OAuth2WebServer#offline
Note you will only get the refresh token once, together with the first access token.