I'm trying to follow the quickstart tutorial for Google Sheets .NET API here.
But when it gets to this line:
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user",
CancellationToken.None,
new FileDataStore(credPath, true)).Result;
Here's what happens:
Internet Explorer opens.
Goes to
accounts.google.com
application authorization window.I click
Allow
.Get redirected to
localhost
. Get this message in IE.
This page can't be displayed
* Make sure the web address http://localhost:54538 is correct.
* Look for the page with your search engine.
* Refresh the page in a few minutes.
- In VS Express, this exception is thrown:
An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll
Additional information: One or more errors occurred.
It's possible that there is a corporate IT security policy in place that is preventing me from accessing this localhost
port; I tried directly typing "localhost" and "127.0.0.1" into the Chrome address bar, and in both cases got a "This site can’t be reached" error.
EDIT: My client_id.json
file is as follows:
{"installed":{"client_id":"[long ID string].apps.googleusercontent.com","project_id":"angular-polygon-162522","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"[secret ID]","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}