NetSuite RESTlet身份验证失败

Mic*_*cho 2 javascript authentication restlet netsuite

我正在尝试在NetSuite中开发一个简单的表单portlet,提交到后端的RESTlet.这是我的表单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');
}
Run Code Online (Sandbox Code Playgroud)

当我点击提交时,我可以在Chrome的开发者控制台中看到状态为206 Partial Content,但我提交的记录没有存储在数据库中,而且在控制台中没有对此请求的响应.

因此,我决定调查与RESTlet的连接.我的问题是我无法通过RESTlet身份验证.这是我的NLAuth标题:

User-Agent:SuiteScript-Call
授权:NLAuth
nlauth_account:TSTDRV1291212
nlauth_email:$ email
nlauth_signature:$ password
nlauth_role:administrator
内容类型:application/json

显然,将'$ email'和'$ password'替换为相应的值.

'nlauth_role'值是Netsuite中的角色ID.

我正在使用Postman来测试这个并且我总是得到" 401 Authorization Required "状态并出现以下错误.

{
"error":
{
"code":"USER_ERROR",
"message":"标题不是NLAuth方案[NLAuth]"
}
}

关于我做错了什么的任何想法?

Zai*_*ikh 7

nlauth值应以逗号分隔,如下所示:

NLAuth nlauth_account: TSTDRV1291212, nlauth_email: $email, nlauth_signature: $password, nlauth_role: administrator`
Run Code Online (Sandbox Code Playgroud)

还有一件事,尝试发送3而不是administrator.它实际上是NetSuite所需的角色ID.

  • 如果有人遇到上述问题,我必须将语法更改为:`NLAuth nlauth_account=TSTDRV1291212, nlauth_email=$email, nlauth_signature=$pass, nlauth_role=3` (2认同)