Click here to Skip to main content
15,888,053 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am working to integrate the zoom api in mvc application, but i am unable to execute the Zoom api/url in c#,
there is a url which i execute in browser it's the Authorize code which is display in url,
but when i try to execute the same url in c# code, i am getting or not getting that code.

please look the following code:

What I have tried:

1) this url return the Authorize code in Url section, but i need that code in code behind.

https://zoom.us/oauth/authorize?response_type=code&client_id=zoLFwEBtT1WxV344QbPheQ&redirect_uri=https://marketplace.zoom.us/DApp

2) same code try to execute in c# code behind, not getting that code(status code 200 without authorize code)
using (var client = new HttpClient())
               {
                   var clientCode = "";
                   client.DefaultRequestHeaders.Clear();
                   client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

                   HttpResponseMessage res = await client.GetAsync("https://zoom.us/oauth/authorize?response_type=code&client_id=zoLFwEBtT1WxV344QbPheQ&redirect_uri=https://marketplace.zoom.us/DApp");
                   if (res.IsSuccessStatusCode)
                   {
                       clientCode = res.Content.ReadAsStringAsync().Result;
                   }
               }


3) this is show status code 0
var client = new RestClient("https://zoom.us/oauth/authorize?response_type=code&client_id=zoLFwEBtT1WxV344QbPheQ&redirect_uri=https://marketplace.zoom.us/DApp");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
IRestResponse response = client.Execute(request);
Posted
Updated 16-Apr-20 1:08am
Comments
F-ES Sitecore 15-Apr-20 5:57am    
Why do you need it in code-behind? What are you planning on doing with it?

1 solution

That's not how OAuth works. The user needs to authorize your application. You cannot do that yourself, because that would be a major security vulnerability.

The redirect_uri parameter needs to point to a valid action on your server. Once the user authorizes your application, the code will be passed to that URL in the querystring.

OAuth 2.0 - Authorization - Documentation[^]
 
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