Solved

API Error - CMN-405 : Login to extension required

  • 15 March 2022
  • 6 replies
  • 591 views

I have established a connection via grant type "password" and generated a token in a sandbox environment.

Now, when I do send a request using any URI, I get the error message below:

{
  "errorCode" : "CMN-405",
  "message" : "Login to extension required",
  "errors" : [ {
    "errorCode" : "CMN-405",
    "message" : "Login to extension required"
  } ]
}

My script worked querying get-information in another production app, but with this new app in sandbox, it's asking to login to an extension which I have already signed into:
https://service.devtest.ringcentral.com/application/users/users/default

What is really needed to be done to resolve this issue? Your help would be most appreciated.


icon

Best answer by Phong1426275020 16 March 2022, 16:38

View original

6 replies

update, also I was able to sign into the RingCentral phone app in the Sandbox Environment following the instruction:


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
Userlevel 1

Tell me what exactly you did. Which API returns that error? And your app client id.

1. No Authentication issue generating the token.

2. Any URI I use this error message generate.

3. $ClientID = "ZN6iThZnTp2ZyMWbXeb3OA"

1647380246504.png

1647380292301.png

It will reject any URI request because the requirement is not met, what does it means by sign into the extension? I could generate the password of the account and used it to establish the api connection.

Userlevel 1

I use our power tool to generate a token and read your sandbox account with my Node JS code. I could read without any problem.

Since you are using PowerShell, I am not an expert in PS so I am not sure what could be wrong, but I am sure that it's something in the code. You can try just for confirming that all params you use and your sandbox is working normal by using one of our SDKs. E.g. the JS SDK. Here is what I just tested. You can perform a full password flow authentication from the code if you want to.

const RingCentral = require('@ringcentral/sdk').SDK

RINGCENTRAL_CLIENTID = "ZN6iThZnTp2ZyMWbXxxxyyyyzzz";
RINGCENTRAL_CLIENTSECRET = "aaaabbbbbccccc-20PRI1YdAYAv5l0VtUJQaiOaztJOT_mlg";
RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com'

var rcsdk = new RingCentral({
      server: RINGCENTRAL_SERVER,
      clientId: RINGCENTRAL_CLIENTID,
      clientSecret: RINGCENTRAL_CLIENTSECRET
  });


var platform = rcsdk.platform()

var tokensObj = {
 "access_token" : "valid-access-token",
 "token_type" : "bearer",
 "expires_in" : 3600,
 "refresh_token" : "abc",
 "refresh_token_expires_in" : 604800,
 "scope" : "ReadAccounts RoleManagement"
}

setToken()

async function setToken(){
  await platform.auth().setData(tokensObj)
  if (platform.loggedIn()){
      console.log("already logged in")
      read_account()
  }else{
    console.log("Tokens expired => Need to relogin!!!")
  }

}

async function read_account() {
  try{
    var resp = await platform.get('/restapi/v1.0/account/~/')
    var jsonObj = await resp.json()
    console.log(jsonObj)
  }catch(e){
    console.log(e.message)
  }
}

Thank you for your help Phong Vu, I found out that my script had an error on pointing the token correctly, it was caching from previous session.


I was able to query and edit the extension.


Have a great day Sir!

Reply