Configure Your App

Stay organized with collections Save and categorize content based on your preferences.

All requests to the Google Tasks API require authentication. The following code demonstrates how to configure your client and authenticate using OAuth 2.0 for native applications.

Java

Follow the setup instructions in the Java Quickstart.

Python

Follow the setup instructions in the Python Quickstart.

.NET

using System;
using System.Threading;
using System.Threading.Tasks;

using Google;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Tasks.v1;
using Google.Apis.Tasks.v1.Data;
using Google.Apis.Services;

namespace Tasks.Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                new ClientSecrets
                {
                    ClientId = "CLIENT_ID_HERE",
                    ClientSecret = "CLIENT_SECRET_HERE",
                },
                new[] { TasksService.Scope.Tasks },
                "user",
                CancellationToken.None).Result;

            // Create the service.
            var service = new TasksService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Tasks API Sample",
            });

            ...
        }
    }
}