oauthhttpclientzohogetasync

Getting authorization for Zoho APIs


I am trying to follow Zoho's guide for getting authorized via OAuth. Unfortunately, the guide seems a little outdated as the API Console doesnt look like the screen shots provided in the guide.

This is what I am trying to accomplish

I'm developing a windows client application. So naturally i chose the Non-Browser Application for my zoho client (in the API Console). Using this client type there is no "Authorized Redirect URIs".

So how am i supposed to get authorized to start using the Zoho APIs?

Currently, i've tried various client types w/ various redirect uris (bogus). I am getting an http code response of 500.

I am basically calling an HttpClient GetAsync(requestUrl ) where requestUrl is defined below:

var scopeValue = $"{scope}&client_id={clientId}&client_secret={secret}&response_type=code&access_type=offline";
var requestUrl = $"https://accounts.zoho.com/oauth/v2/auth?scope={scopeValue}";

Question

Just for FYI, here is the Zoho API Console with the various client types to choose from:

enter image description here


Solution

  • Try going to a different requestUrl. I believe you should be going here. You should also be using a POST request. I chose the Non-Browser Application for my zoho client (in the API Console). And I am able to get a response.

    https://accounts.zoho.com/oauth/v3/device/code?client_id=xxxx&scope=ZohoProjects.tasklists.READ&grant_type=device_request
    

    I wrote this in VBA only for trouble shooting this question.

        Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
        Url = "https://accounts.zoho.com/oauth/v3/device/code?" & _
            "client_id=xxx&" & _
            "scope=ZohoProjects.tasklists.READ&" & _
            "grant_type=device_request"
        objHTTP.Open "POST", Url, False
        objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
        objHTTP.Send ("")
    
        replyTXT = objHTTP.responseText
        Debug.Print (replyTXT)
    

    I believe this link has some helpful information. https://www.zoho.com/accounts/protocol/oauth/devices/initiation-request.html