Problem requesting Grant Token with C# desktop application

Problem requesting Grant Token with C# desktop application

Greetings,

I'm new Zoho and am looking to use the API via a C# desktop application.  I am following the first steps in the following guidelines to request a Grant Token and subsequently request Access and Refresh Tokens:


I have used the API Console to register a Self Client application as there is no user-interface to be dealt with...just a simple retrieval of data in the background.  

This is the C# code that I am using to fetch the Grant Token, but unfortunately, it's returning HTML code instead of JSON content containing what looks like Grant Token.  Have I missed the mark completely?

Thanks,
Scott

  1. public void GetZohoGrantToken()
  2.         {
  3.             try
  4.             {
  5.                 ServicePointManager.Expect100Continue = true;
  6.                 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  7.                 ServicePointManager.DefaultConnectionLimit = 9999;

  8.                 HttpWebRequest GroupsRequest = (HttpWebRequest)WebRequest.Create("https://accounts.zoho.com/oauth/v2/auth?scope=ZohoBooks.fullaccess.all&client_id=1000.993FJS7NKWGHRAPZ71W6IW16GYC1WA&response_type=code&redirect_uri=http://www.zoho.com/books&access_type=offline");

  9.                 GroupsRequest.AllowAutoRedirect = true;
  10.                 GroupsRequest.ContentType = "application/json";
  11.                 GroupsRequest.Accept = "*/*";
  12.                 GroupsRequest.Method = "GET";
  13.                  
  14.                 WebResponse GroupsResponse = GroupsRequest.GetResponse();
  15.                 Stream GroupsDataStream = GroupsResponse.GetResponseStream();
  16.                 StreamReader GroupsDataStreamReader = new StreamReader(GroupsDataStream);
  17.                 string GroupsContentFromServer = GroupsDataStreamReader.ReadToEnd();

  18.                 Console.WriteLine(GroupsContentFromServer);

  19.                 GroupsDataStreamReader.Close();
  20.                 GroupsDataStreamReader = null;
  21.                 GroupsResponse.Close();
  22.                 GroupsResponse = null;
  23.                 GroupsRequest = null;

  24.             }
  25.             catch (Exception ex)
  26.             {
  27.                 Console.WriteLine(ex.InnerException);
  28.             }

  29.         }



      Zoho Marketing Automation

            Zoho Pagesense Resources

              Zoho SalesIQ Resources



                    Zoho TeamInbox Resources

                      Zoho DataPrep Resources



                        Zoho CRM Plus Resources

                          Zoho Books Resources


                            Zoho Subscriptions Resources

                              Zoho Desk Resources

                                Zoho Projects Resources


                                  Zoho Sprints Resources


                                    Qntrl Resources


                                      Zoho Creator Resources


                                        Zoho WorkDrive Resources





                                            Zoho Campaigns Resources

                                              Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now