1

我们已尝试使用 JavaScript SDK 连接到 RingCentral 中的 RingCentral 令牌认证 URL。

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

我们收到 Http 400(Bad Request) - Unauthorized for this grant type 错误。

400 Bad Request

{
    "error": "unauthorized_client",
    "error_description": "Unauthorized for this grant type",
    "errors": [
        {
            "errorCode": "OAU-251",
            "message": "Unauthorized for this grant type"
        }
    ]
}

这是我的代码:

var SDK = require('ringcentral');
   var rcsdk = new SDK({ 
       server: SDK.server.sandbox, 
       appKey: 'appkey',
       appSecret: 'appSecret',
       redirectUri: ''
   });
   rcsdk.platform()
   .login({
       username: 'phone number', // phone number in full format
       extension: 101, // leave blank if direct number is used
       password: 'password'
   })
   .then(function(response) {
       console.log(response)
   })
   .catch(function(e) {
       console.log(e.message  || 'Server cannot authorize user');
   });

提前致谢

4

1 回答 1

1

此 JS SDK 请求使用 OAuth 2.0 密码流授权类型。要将其与 RingCentral API 一起使用,您需要确保在您的应用的 OAuth 设置中为您的应用配置此授权类型。

有关如何执行/验证此问题的答案,请参阅以下 Stack Overflow 线程,包括屏幕截图。

卷曲呼叫中的 RingCentral 身份验证令牌失败

于 2017-12-11T01:52:48.863 回答