Authorization Code Flow.Geting Error (401) Unauthorized.

  • 1
  • Problem
  • Updated 7 months ago
  • (Edited)
This is my code.I made a public sandbox account.Geting an error 401 unauthorized.

  var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://platform.devtest.ringcentral.com/restapi/oauth/authorize");
               
                httpWebRequest.Method = "GET";

                httpWebRequest.Headers.Add("client_id", "DShb1**********2DlM5xoA");
                httpWebRequest.Headers.Add("redirect_uri", "http://localhost:505471/");
                httpWebRequest.Headers.Add("response_type", "code");
                httpWebRequest.Headers.Add("state", "Client state");
                httpWebRequest.Headers.Add("prompt", "login");


var httpresponse = httpWebRequest.GetResponse();
Photo of Etam Singh

Etam Singh

  • 160 Points 100 badge 2x thumb

Posted 7 months ago

  • 1
Photo of Phong Vu

Phong Vu, Devangelist

  • 2,816 Points 2k badge 2x thumb
Can you let me know what type of RC app did you defined. Is your localhost on your local machine? And did you set the same redirect_uri's value to the "OAuth Redirect URI" field for your app?

Is there any reason you don't want to use our SDKs for your code?

+ Phong
Photo of Etam Singh

Etam Singh

  • 160 Points 100 badge 2x thumb
Thanks for ur response Phong Vu.
Now I am using Ring Central sdk and I am able to authorize user  and get token in response.
(Edited)