Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please bare with me. Rookie on the block. I am tasked to provide clientcallback url and this needed to authenticate zoho desk

host: https://accounts.zoho.com
path: /oauth/v2/auth
response_type: code
client_id: ###
scope: Desk.tickets.READ,Desk.basic.READ,Desk.tickets.CREATE,Desk.basic.CREATE
redirect_uri: mydomain.com/authenticate

Question is how do I create a page call it authenticate and get the token back?

What I have tried:

string baseAddress = "http://localhost/";
var client = new HttpClient();
var form = new Dictionary<string, string>
{
    {"grant_type", "client_credentials"},
    {"client_id", "clientId"},
    {"client_secret", "secretKey"},
};

var tokenResponse = client.PostAsync(baseAddress + "accesstoken", new FormUrlEncodedContent(form)).Result;
var token = tokenResponse.Content.ReadAsAsync<Token>(new[] { new JsonMediaTypeFormatter() }).Result;
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var authorizedResponse = client.GetAsync(baseAddress + "/api/Tests").Result;
Posted
Updated 19-Nov-18 1:09am

 
Share this answer
 
v2
So...that redirecturi can be anything from what I heard. Then get the code from the address bar and do post with that code, clientid, clientsecret and scope and other permissions.

Is that a true statement for the redirecturi can be anything?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900