[英]Failed NetSuite RESTlet authentication
I'm trying to develop in NetSuite a simple form portlet submitting to a RESTlet in the back end.我试图在 NetSuite 中开发一个简单的表单 portlet,提交到后端的 RESTlet。 Here's my form portlet:
这是我的表单 portlet:
function workManagerPortlet(portlet, column) {
portlet.setTitle('Portlet');
portlet.addField(....)
// INSERT HERE ALL THE FORM FIELDS
portlet.setSubmitButton(nlapiResolveURL('RESTLET', 'customscript_gw_ss_form_backend', 'customdeploy_wm_form_backend', true), 'Submit', '_hidden');
}
When I click on submit I can see in Chrome's developer console the status is 206 Partial Content , but the record I'm submitting is not being stored in the database and in the console there's no response for this request.当我点击提交时,我可以在 Chrome 的开发者控制台中看到状态为206 Partial Content ,但我提交的记录没有存储在数据库中,并且在控制台中没有对此请求的响应。
Therefore, I decided to investigate the connection to the RESTlet.因此,我决定调查与 RESTlet 的连接。 My problem is that I cannot get past the RESTlet authentication.
我的问题是我无法通过 RESTlet 身份验证。 Here are my NLAuth headers:
这是我的 NLAuth 标头:
User-Agent: SuiteScript-Call
用户代理:SuiteScript-Call
Authorization: NLAuth授权:NLAuth
nlauth_account: TSTDRV1291212nlauth_account:TSTDRV1291212
nlauth_email: $emailnlauth_email: $email
nlauth_signature: $passwordnlauth_signature: $password
nlauth_role: administratornlauth_role: 管理员
Content-Type: application/json内容类型:应用程序/json
Obviously, replacing '$email' and '$password' for the corresponding values.显然,将 '$email' 和 '$password' 替换为相应的值。
The 'nlauth_role' value is the role id in Netsuite. “nlauth_role”值是 Netsuite 中的角色 ID。
I'm using Postman to test this and I always get a " 401 Authorization Required " status and the following error.我正在使用 Postman 来测试这个,我总是得到“ 401 Authorization Required ”状态和以下错误。
{
{
"error":“错误”:
{{
"code": "USER_ERROR","code": "USER_ERROR",
"message": "header is not NLAuth scheme [ NLAuth ]""message": "header 不是 NLAuth 方案 [NLAuth]"
}}
}}
Any ideas about what I'm doing wrong?关于我做错了什么的任何想法?
nlauth values should be comma separated like this: nlauth 值应以逗号分隔,如下所示:
NLAuth nlauth_account: TSTDRV1291212, nlauth_email: $email, nlauth_signature: $password, nlauth_role: administrator`
One more thing, trying sending 3
instead of administrator
.还有一件事,尝试发送
3
而不是administrator
。 It's role id actually which is required by NetSuite.它实际上是 NetSuite 所需的角色 ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.