简体   繁体   English

使用windows form c#登录谷歌

[英]Login to Google using windows form c#

Hi everyone I have a problem I wanna create app for generate account google drive with api google drive and I don't know how can I login with account from application not navigator C# windows form.大家好,我有一个问题,我想创建应用程序以使用 api google drive 生成​​帐户谷歌驱动器,但我不知道如何使用应用程序而不是导航器 C# windows 窗体中的帐户登录。 enter image description here在此处输入图片说明

and how can i edit this credential with exist user以及如何使用现有用户编辑此凭据

Try following these steps: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins?view=aspnetcore-3.1尝试执行以下步骤: https : //docs.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins?view=aspnetcore-3.1

I have used those steps and worked perfectly for me.我已经使用了这些步骤并且非常适合我。 You don't have a choice than to be redirected to the Google authentication page.除了重定向到 Google 身份验证页面之外,您别无选择。 After entering your Google credentials, you are redirected back to the your site.输入您的 Google 凭据后,您将被重定向回您的站点。

My understanding is that you are trying to use Google Drive API from a console application.我的理解是您正在尝试从控制台应用程序使用Google Drive API Or for that matter a fully desktop application.或者就此而言,一个完整的桌面应用程序。

Take one thing in consideration, if you don't use Service account you must let the user authenticate to google and allow your application to work in his/her behalf.考虑一件事,如果您不使用服务帐户,您必须让用户向 google进行身份验证并允许您的应用程序代表他/她工作。 There is no way around this .没有办法解决这个问题

What you can do is after the user has already signed in, is to save the tokens and refresh them whenever necessary.您可以做的是在用户已经登录后,保存令牌并在必要时刷新它们

Of course OAuth may be complicated, but you use the .NET library everything will be managed for you.当然,OAuth 可能很复杂,但您使用.NET 库,一切都会为您管理。 And you can look at a real example in the .NET Drive Quickstart您可以.NET Drive Quickstart 中查看一个真实示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM