Failed to get Google Task list with. NET Call Googleapi

Source: Internet
Author: User
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]}

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.