Accessing Google Drive from Windows service

拜拜、爱过 提交于 2019-12-02 04:47:13

The quickstart application is a simplified command-line app that cuts some corners to make the getting started experience quicker but it can still be used as a starting point for a Windows service.

If you don't want to launch the browser, you have to remove the call to Process.Start(authUri.ToString()) and perhaps print the authorization url to the console so that the user can copy the link.

You only need to perform this manual step once, as long as the application stores the refresh token and the access token that are returned when exchanging the access code. The access token expires after one hour but the refresh token never expires (unless the user manually revokes access to the app) and the latter is the one that is used to request new access tokens.

The documentation also includes a complete .NET application that shows how to store the tokens and how to address the various authorization edge cases: https://developers.google.com/drive/examples/dotnet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!