News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Authorization Code Flow.Geting Error (401) Unauthorized.
Tags: authentication, errors
Feb 16, 2018 at 2:57am   •   3 replies  •  0 likes
etam-singh

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();

3 Answers
answered on Jun 28, 2019 at 10:38pm  

Since the oauth type is Authorization code, make sure all the parameters are provided.

If you miss redirect uri parameter in request which is a mandatory part, you will unable to get token which is supposed to be exchanged with access token


 0
answered on Feb 19, 2018 at 10:56pm  
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.

 1
answered on Feb 19, 2018 at 3:11pm  
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

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us