【发布时间】:2018-04-30 09:08:34
【问题描述】:
我们已尝试使用 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');
});
提前致谢
【问题讨论】:
-
您确定要公开您的应用密钥/秘密吗?我知道这只是测试,但也许用 [appkey] 和 [appSecret] 替换它们是个好主意?与用户名/密码相同。
-
你的意思是需要数组中的 appkey 吗??
-
我的意思是你的代码中的那个——全世界都可以在这里看到。
-
@Aaron 抱歉没听懂
-
您的信息是可见的。我可以看到它的人。如果我能看到,其他人都能看到。如果我愿意,我可以使用您在帖子中提供的密码、ID、用户名和密码来连接到您的端点并访问您的数据。这不是一个很难的概念。看看你的帖子,就在这个上面。它就在那里。此评论上方 6 英寸。您的 appKey 以“DVCy”开头,您的 appsecret 以“DvE2”开头,您的用户名是电话号码,您的密码是人名……全世界都可以看到。 “appSecret”中的“secret”名称应该会提示您。
标签: javascript oauth-2.0 ringcentral