How to get long-lived access token Google API

.net-4.0, c#, google-data-api, google-docs-api, winforms

Solution

Ok , After some time i solved it.

After you get an access token , you also get an refresh token. store that token!

Also do this `parameters.AccessToken = StoredRefreshToken` and `parameters.RefreshToken = StoredRefreshToken` before you make your next request call `OAuthUtil.RefreshAccessToken(parameters);`

And then you should be good to make a request!

Problem

In the Google documentation it says ``` // Once the user authorizes with Google, the request token can be exchanged // for a long-lived access token. If you are building a browser-based // application, you should parse the incoming request token from the url and // set it in OAuthParameters before calling GetAccessToken(). ``` but it doesn't say or show how to do that :( Does anyone know how to do that for a desktop app? Code samples are more than welcome!

Original source