question

Element Developer avatar image
Element Developer asked Element Developer edited

Getting "Login error Error: Authorization code was not issued for this application" in Auth Code Flow

Hi

I am in Authorization Code Flow to get access token.


I am getting the "Login error Error: Authorization code was not issued for this application" at the first step getting the authorization code. I did GET method and it did work for the other application and I wanted to make another application and this is not working.

It is Server/Web App so Authorization Code Flow should work for it.

Why I am getting this error? Anybody knows the answer?

authentication
2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

Can you describe your problem better. I am not sure how to help when you said "I did GET method and it did work for the other application and I wanted to make another application and this is not working."

0 Likes 0 ·
Element Developer avatar image Element Developer Phong Vu ♦♦ commented ·

I guess I got those errors as auth code is expired. What should I do to refresh the auth code?

0 Likes 0 ·
Phong Vu avatar image
Phong Vu answered Phong Vu commented

As you said you guessed that the access token is expired. In that case, use the refresh token to ask for a new access token. Post this body to the "auth" endpoint

{
  'grant_type' : 'refresh_token',
  'refresh_token' : "your refresh token"
}


4 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Element Developer avatar image Element Developer commented ·

Is the endpoint literally as /auth/? or /restapi/oauth/authorize ?

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Element Developer commented ·

'/restapi/oauth/token'

0 Likes 0 ·
Element Developer avatar image Element Developer Phong Vu ♦♦ commented ·

Hi I tried

curl -X POST "https://platform.devtest.ringcentral.com/restapi/oauth/token" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Basic <MyAuth>“ -d '{'grant_type':'refresh_token','refresh_token':"your refresh token"}'

but I am getting

 "error" : "invalid_request",  "errors" : [{    "errorCode" : "OAU-250",    "message" : "Unsupported grant type"  }  "error_description" : "Unsupported grant type" }


What I am doing wrong?

0 Likes 0 ·
Show more comments
Anirban avatar image
Anirban answered Element Developer commented

Here is the way to get access token from refresh token:

https://platform.devtest.ringcentral.com/restapi/oauth/token


username=<your user name>&password=<your password>&extension=<your extension>&grant_type=refresh_token&refresh_token=<your refresh token generated>

Now it will generate new access token from refresh token

2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Anirban avatar image Anirban commented ·

Content-Type : application/x-www-form-urlencoded;charset=UTF-8

Accept: application/json

Authorization: Basic <base64 clientid:client secret>


0 Likes 0 ·
Element Developer avatar image Element Developer Anirban commented ·

Thank you. But actually I was working on another app and trying auth code flow. But I am getting "Auth Code was not issued for this application" when getting auth code. W
hy is this happening and how can I get auth code? This app is browser-based so auth code flow should be working.

0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys