I've created a Windows Console Application that uses the Google Sheets API, following this link and it worked perfectly.
However when I try to build a Windows Service to do the same thing, it freezes at Authorization, presumably because the web page doesn't popup allowing me to authorize it (which makes sense for a Service).
How can I authorize it? The link says
If this fails, copy the URL from the console and manually open it in your browser
which would be great if I knew what the URL was.
Not a definite answer, but OAuth is designed rather for interactive scenarios involving users.
For service, you should create service account in google developer console and create private key for it ( https://developers.google.com/identity/protocols/OAuth2ServiceAccount ).
Then you have to change your code to use JWT authentication token derived from private key created in first step.
Someone already answer how to do it in C#: Is there a JSON Web Token (JWT) example in C#?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.