如何获得长期访问令牌Google API

Avi*_*rix 7 c# .net-4.0 winforms google-docs-api google-data-api

在谷歌文档中说

// 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().
Run Code Online (Sandbox Code Playgroud)

但它没有说或显示如何做到这一点:(

有谁知道如何为桌面应用程序这样做?

代码样本非常受欢迎!

Avi*_*rix 9

好的,过了一段时间我解决了.

获得访问令牌后,您还会获得刷新令牌.存储那个令牌!

同样做到这一点parameters.AccessToken = StoredRefreshTokenparameters.RefreshToken = StoredRefreshToken 你让你的下一个请求调用之前OAuthUtil.RefreshAccessToken(parameters);

然后你应该好好提出要求!