News & Announcements User Community Developer Community

Welcome to the RingCentral Community

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

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
Authorize takes forever with password flow
Tags: getting started
May 8, 2019 at 10:08pm   •   2 replies  •  0 likes
station 1 lurie


I use nuget RingCentral.Net to connect to API and Password flow with sandbox Server only platform

When I connect with console application with the following code I succeed (get token and get call logs)

var rc = new RestClient(Config.Instance.clientId, Config.Instance.clientSecret, Config.Instance.server); 
var token = rc.Authorize(Config.Instance.username, Config.Instance.extension, Config.Instance.password).Result; 

When I try to connect to api with an application (ASP.NET MVC) that is on IIS the authorize takes forever, without exception

2 Answers
answered on May 14, 2019 at 8:16am  
Thanks, call log work perfect but when i want to send sms like

static async Task Main(string[] args)
using (var rc = await Login()) { await SendSms(rc); } }
private static async Task<RestClient> Login()
    var rc = new RestClient("***", "*********", "");
    await rc.Authorize("+*****", "101", "*****");
    return rc;
} public static async Task SendSms(RestClient rc)
    var sms = new CreateSMSMessage()
        @from = new MessageStoreCallerInfoRequest() { phoneNumber = "+****" },
        to = new[] { new MessageStoreCallerInfoRequest() { phoneNumber = "+****" }, },
        text = "test yaacov"
     var resTask = await rc.Restapi().Account().Extension("101").Sms().Post(sms);
The Authorize return token but post sms get exception 
System.ObjectDisposedException: 'Cannot access a disposed object.
Object name: 'System.Net.Http.StringContent'.'
When i run same details with Api reference "try it out" button it work fine

answered on May 8, 2019 at 10:30pm  
Hi, it might be deadlock issue.

And it is a common C# async programming issue:

In short, do not mixed async code and sync code.  If your app is async overall, you should not use .Result.


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

Developer Platform
Integrated Apps
App Gallery
Developer support
Games and rewards

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