A sample demonstrating how to authenticate with Google's APIs using Application Default Credentials Application Default Credentials from C#. The sample authenticates and then makes an API request to the Cloud Storage API.
-
Follow the instructions in the root README.
-
Install the Google Cloud SDK. If you haven't already installed the Google Cloud SDK, install and initialize the Google Cloud SDK now. The SDK contains tools and libraries that enable you to create and manage resources on Google Cloud Platform.
-
Enable APIs for your project. Click here to visit Cloud Platform Console and enable the Cloud Storage API.
-
Create a Cloud Storage bucket for your project. Cloud Storage allows you to store and serve binary data. A bucket is a high-level container for binary objects. At a command prompt, type:
C:\> gsutil mb gs://<your-project-id> C:\> gsutil defacl set public-read gs://<your-project-id>
-
Open AuthSample.sln with Microsoft Visual Studio version 2012 or later.
-
Build the Solution.
-
From the command line, set environment variables and run:
C:\...\bin\Debug> set GOOGLE_PROJECT_ID=your project id displayed on the Google Developers Console. C:\...\bin\Debug> AuthSample <the name of the Google Cloud Storage bucket you created>
- See CONTRIBUTING.md
- See LICENSE