Unauthorized for this grant type error

  • 1
  • Article
  • Updated 2 years ago
  • (Edited)
Are getting this  error

"error": "unauthorized_client"
"error_description": "Unauthorized for this grant type"

when you try /oauth/token API authorize your application  ?

Is your application type  ==> Web/UI based or browser based application? 

If the answer is yes you will need to follow 3 legged OAuth flow to authorize your application. 

The authorization code flow provides the following benefits:
  1. a consistent and trusted UI
  2. integrated password reset
  3. integrated single sign-on (SSO) via SAML support

For more information please check out this link:


Photo of VB

VB, Official Rep

  • 1,510 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Duane Smith

Duane Smith

  • 70 Points
I'm also getting this exact same error using Advanced REST client and vb.net desktop application.
Photo of AK

AK, Official Rep

  • 4,412 Points 4k badge 2x thumb
Hi Duane,

Could you please check the application type, login to the developer portal ( https://developer.ringcentral.com ) and click on the application and under settings you should see the "Platform Type" . If the platform type is any one of below :
  • Browser-Based
  • Server-Web
  • Server-Only
Then you would need to follow the OAuth 2.0 Code flow for authentication. You could find more information and sample codes here : https://devcommunity.ringcentral.com/ringcentraldev/topics/using-oauth-2-0-authorization-code-grant-...
Photo of Chris Dierdorff

Chris Dierdorff

  • 60 Points
the information here is telling us what OAuth 2.0 is, not how to use it. Are there any resources that help new developers actually USE this auth type? 
Photo of Duane Smith

Duane Smith

  • 70 Points

It's a vb.net desktop application. In Platform Type I have Desktop/Windows.

I'm using Resource Owner Password Credentials Flow (ROPC), also named Password Flow.

Using the SDK c# code tests from RingCentral, it works fine. However, running very similar .net 2.0 code it doesn't. Also, running the RingCentral API Explorer and Advanced REST client doesn't work. Here's the code I'm using:

        Dim client As New WebClient()        
        Dim parameters As String = "grant_type=password" &
                                   "&username=15623520324" &
                                   "&extension=101" &
                                   "&password=" & password
        Dim URL As String = GetUrl("restapi/oauth/token")
        client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded;charset=UTF-8")
        client.Headers.Add(HttpRequestHeader.Authorization, "Basic " & GetApiKey())
        Dim result As String = client.UploadString(URL, "POST", System.Web.HttpUtility.UrlEncode(parameters))
        Return result

Photo of Zeeshan Yousaf

Zeeshan Yousaf

  • 220 Points 100 badge 2x thumb
Hi, i m trying to use JS Liberary  but getting same error. if some one could guide it would be great help my code as below:

$(document).ready(function() {
 var RC_SERVER_PRODUCTION = 'https://platform.ringcentral.com';
 var RC_SERVER_SANDBOX = 'https://platform.devtest.ringcentral.com';
 //var RC_SERVER_SAOX = 'https://service.devtest.ringcentral.co.uk';
 var rcsdk = new RingCentral.SDK({
 var platform = rcsdk.platform();
        username: '+4420377136XX', // phone number in full format which is given under sandbox credentials

        extension: '301', // Admin default

        password: 'XXXXXXXXXXXXX' // Here my ringcentral developer account password

    .then(function(response) {
          // your code here
    .catch(function(e) {
        alert(e.message  + 'Server cannot authorize user');
Photo of CFHE Reception

CFHE Reception

  • 130 Points 100 badge 2x thumb
The following works fine for me. Maybe it will help.

Public Const RingCentralTokenURI = "https://platform.ringcentral.com/restapi/oauth/token "
Public Const LoginUserName = "%2B18185555555"
Public Const LoginPassword = "mypassword"

Dim httpRequest As New MSXML2.XMLHTTP
Dim PayLoad As String

PayLoad = "grant_type=password&username=" & LoginUserName & "&extension=119&" & "password=" & LoginPassword
httpRequest.Open "POST", RingCentralTokenURI, False
httpRequest.setRequestHeader "Authorization", "Basic xxxxxxxxxxxxxxxxxxx"    httpRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"
httpRequest.Send PayLoad
Access_Token = "Bearer " & Mid(Mid(httpRequest.responseText, InStr(1, httpRequest.responseText, """access_token"" : """) + 18), _
        1, InStr(1, Mid(httpRequest.responseText, InStr(1, httpRequest.responseText, """access_token"" : """) + 18), """,") - 1)

 Debug.Print Access_Token