c# - 如何获得长期访问 token Google API

标签 c# winforms .net-4.0 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().

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

有人知道如何为桌面应用执行此操作吗?

非常欢迎代码示例!

最佳答案

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

获得访问 token 后,您还会获得刷新 token 。存储该 token !

同时执行此操作 parameters.AccessToken = StoredRefreshTokenparameters.RefreshToken = StoredRefreshToken 在发出下一个请求之前调用 OAuthUtil.RefreshAccessToken(parameters);

然后你就可以提出请求了!

关于c# - 如何获得长期访问 token Google API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10556864/

相关文章:

c# - 如何覆盖 ServiceStack 中的默认 404 页面?

c# - .NET TreeNode 能否知道它的父级已更改?

c# - 使用图像而不是平铺填充纹理画笔

c# - 使用特定的重载而不进行强制转换?

.net - Entity Framework 和 .NET 4.0 的 LINQ to SQL 之间有什么区别?

javascript - 修复无效 JSON 的最有效方法

c# - 具有来自其他数据表的 id 的数据表,需要转换此数据表以将 id 替换为其数据表名称列值

c# - C# Dictionary 在 C# in depth 2nd Edition 中是如何使用的?

c# - Javascript:如何遍历模型中的对象列表

c# - 如何在 UserControl 中设置设计 View 项,以便多个子控件具有这些项