C#clientcallback oauth2 [英] C# clientcallback oauth2
问题描述
请和我一起露面。新秀在街区。我的任务是提供clientcallback网址,这需要验证zoho桌面
主机:https://accounts.zoho.com
路径:/ oauth / v2 / auth
response_type:code
client_id:###
范围:Desk.tickets.READ,Desk.basic .READ,Desk.tickets.CREATE,Desk.basic.CREATE
redirect_uri:mydomain.com/authenticate
问题我是怎么做的创建一个页面调用它进行身份验证并获取令牌?
我尝试过:
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;
推荐答案
通常使用 WebRequest ,请参见此示例: API示例|开发人员帮助 - Zoho CRM [ ^ ]
对于API 2.0: https://help.zoho.com/portal/community/topic/authorization-to-api-2-0-via-c [ ^ ]
Usually WebRequest is used, see example here: API Examples | Developer Help - Zoho CRM[^]
And for the API 2.0: https://help.zoho.com/portal/community/topic/authorization-to-api-2-0-via-c[^]
所以redirecturi可以是我所听到的任何内容。然后从地址栏中获取代码并使用该代码,clientid,clientsecret和scope以及其他权限发布。
这是redirecturi的真实陈述可以是什么吗?
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?
这篇关于C#clientcallback oauth2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!