Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get long-lived access token Google API

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!

like image 626
Nikola Sivkov Avatar asked May 11 '12 18:05

Nikola Sivkov


1 Answers

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!

like image 182
Nikola Sivkov Avatar answered Sep 25 '22 06:09

Nikola Sivkov