question

John Lee avatar image
John Lee asked John Lee commented

API Error - CMN-405 : Login to extension required

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.


rest apierrorslog in
1 comment
1 |3000

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

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
0 Likes 0 ·

1 Answer

Phong Vu avatar image
Phong Vu answered John Lee commented

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)
  }
}
5 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.

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!

2 Likes 2 ·

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

0 Likes 0 ·

1. No Authentication issue generating the token.

2. Any URI I use this error message generate.

3. $ClientID = "ZN6iThZnTp2ZyMWbXeb3OA"

1647380246504.png

1647380292301.png

0 Likes 0 ·
1647380246504.png (49.8 KiB)
1647380292301.png (107.1 KiB)

And you authenticated with the username and password of the user John Lee? How about if you authenticate with the user name and password of Ming Lee, the super admin in your sandbox account?

0 Likes 0 ·

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.

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