Question

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!

Was it helpful?

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!

OTHER TIPS

Are you using AuthSub with the .NET Client Library. If so, try this

if (Request.QueryString["token"] != null)
{
    String token = Request.QueryString["token"];
    Session["token"] = AuthSubUtil.exchangeForSessionToken(token, null).ToString();
    Response.Redirect(Request.Url.AbsolutePath, true);
}​

P.S: The above link has the complete listing of code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top