The code is as follows
static void Main (string[] args) {//Register the authenticator. The Client ID and secret has the copied from the API Access//tab on the Google APIs Console. var Provider = new Nativeapplicationclient (googleauthenticationserver.description); Provider. Clientidentifier = "272908629865.apps.googleusercontent.com"; Provider. Clientsecret = "4umdindilov5bv-qrqz2xuwa"; var auth = new Oauth2authenticator<nativeapplicationclient> (provider, getauthentication); Create the service and register the previously created OAuth2 Authenticator. var service = new Tasksservice (auth); tasklists results = service. Tasklists.list (). Fetch (); foreach (TaskList list in results. Items) {Console.WriteLine (list. Title); }} private static Iauthorizationstate getauthentication (Nativeapplicationclient arg) {// Get the AUTH url:iauthorizationstate state = new Authorizationstate (new[] {TasksService.Scopes.Tasks.ToString ()}); State. Callback = new Uri (Nativeapplicationclient.outofbandcallbackurl); Uri Authuri = arg. Requestuserauthorization (state); Request authorization from the user (by opening a browser window): Process.Start (Authuri.tostring ()); Console.Write ("Authorization Code:"); String authcode = Console.ReadLine (); Console.WriteLine (); Retrieve the access token by using the authorization Code:return ARG. Processuserauthorization (Authcode, state); }
Run
Process.Start (Authuri.tostring ()); The result in the browser is:
OAuth2.0 Error: Invalid_scope
You can email the developer of this application at:jipen ... @gmail. com
Some requested scopes were invalid. {Invalid=[tasks]}