使用asp.net MVC中的Google.Apis.Drive.v3将文件上传到谷歌驱动器 [英] Upload files to google drive using Google.Apis.Drive.v3 in asp.net MVC

查看:148
本文介绍了使用asp.net MVC中的Google.Apis.Drive.v3将文件上传到谷歌驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用asp.net MVC中的Google.Apis.Drive.v3将文件上传到Google Drive。我希望我的访问者将文件上传到我的谷歌驱动器,我将在代码中设置我的谷歌驱动器的凭据。任何人都可以帮助我完成这项工作吗?

I want to upload files to Google Drive using the Google.Apis.Drive.v3 in asp.net MVC. I want my visitor to upload the files to my google drive, I will set the credentials of my google drive in code. Can anyone help me to get this work?

我尝试了上传的快速入门示例,但每次都要求提供证书。或者它使用缓存的凭证。

I tried the quick start sample for upload but it asks for the credentials every time. Or it uses the cached credential.

如何在不知道用户对凭证的知情的情况下上传文件?

How can I upload a file without knowing the user about the credential?

推荐答案

根据此文档 ,您需要获取访问凭据才能启用Google云端硬盘。如果您希望以编程方式访问用户数据而无需手动授权,请执行 Google Apps域范围授权。通过这种方式委托权限,域管理员可以使用服务帐户和 OAuth 2.0 。您也可以查看此链接,这可能会有所帮助。

According to this documentation, you need to get the access credentials to enable the Google Drive. If you want to programmatically access users data without any manual authorization on their part, then perform Google Apps Domain-Wide Delegation of Authority. To delegate authority this way, domain administrators can use service accounts with OAuth 2.0. You can also check on this link which might help.

这篇关于使用asp.net MVC中的Google.Apis.Drive.v3将文件上传到谷歌驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆