-
- Customers
- Developers
- Sign in
To use the RingCentral API, an access and refresh token are needed. The simplest way to get an access token needed for production resources is to complete Two-legged Authorization Flow (OAuth 2.0). The required fields are below:
ApplicationKey granted after successful application/developer registration. Required.
ApplicationSecret granted after successful application/developer registration. Required.
UserName main company number of a RingCentral account or direct extension phone number (unformatted, sequence of digits starting with country code). Required.
Extension extension number to log into for the RingCentral account. Required if main company number is provided as a UserName.
Password for the RingCentral account. Required.
public static string Base64Encode(string plainText) { var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); return System.Convert.ToBase64String(plainTextBytes); }
//Be sure to run "Install-Package Newtonsoft.Json -Version 7.0.1" from your nuget command line. //Be sure to run "Install-Package System.Net.Http -Version 4.0.0" from your nuget command line. HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "BASE64 ENCODED APPKEY:APPSECRET");<br> FormUrlEncodedContent form = new FormUrlEncodedContent(new Dictionary { { "username", "username" }, { "password", "password" }, { "grant_type": "password" }, { "extension": "extension" } } ); Task message = client.PostAsync( "https://platform.devtest.ringcentral.com/restapi/oauth/token", form ); String result = message.Result.Content.ReadAsStringAsync().Result; JObject RCAuth = JObject.Parse( result ); string token = ( string )RCAuth["access_token"] string refreshToken = ( string )RCAuth["refresh_token"]; string tokenExpires = ( string )RCAuth["access_token_expires_in"]; string refreshTokenExpires = ( string )RCAuth["refresh_token_expires_in"];
5 People are following this question.
Team messaging, video meetings
and phone - all in one app.
Get the new RingCentral app