admin管理员组文章数量:1331449
I'm trying to develop in NetSuite a simple form portlet submitting to a RESTlet in the back end. Here's my form 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.
Therefore, I decided to investigate the connection to the RESTlet. My problem is that I cannot get past the RESTlet authentication. Here are my NLAuth headers:
User-Agent: SuiteScript-Call
Authorization: NLAuth
nlauth_account: TSTDRV1291212
nlauth_email: $email
nlauth_signature: $password
nlauth_role: administrator
Content-Type: application/json
Obviously, replacing '$email' and '$password' for the corresponding values.
The 'nlauth_role' value is the role id in Netsuite.
I'm using Postman to test this and I always get a "401 Authorization Required" status and the following error.
{
"error":
{
"code": "USER_ERROR",
"message": "header is not NLAuth scheme [ NLAuth ]"
}
}
Any ideas about what I'm doing wrong?
I'm trying to develop in NetSuite a simple form portlet submitting to a RESTlet in the back end. Here's my form 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.
Therefore, I decided to investigate the connection to the RESTlet. My problem is that I cannot get past the RESTlet authentication. Here are my NLAuth headers:
User-Agent: SuiteScript-Call
Authorization: NLAuth
nlauth_account: TSTDRV1291212
nlauth_email: $email
nlauth_signature: $password
nlauth_role: administrator
Content-Type: application/json
Obviously, replacing '$email' and '$password' for the corresponding values.
The 'nlauth_role' value is the role id in Netsuite.
I'm using Postman to test this and I always get a "401 Authorization Required" status and the following error.
{
"error":
{
"code": "USER_ERROR",
"message": "header is not NLAuth scheme [ NLAuth ]"
}
}
Any ideas about what I'm doing wrong?
Share Improve this question edited Sep 11, 2020 at 22:41 quarks 35.4k82 gold badges308 silver badges546 bronze badges asked Jun 8, 2015 at 8:45 MichoMicho 3,96313 gold badges39 silver badges41 bronze badges 4-
2
nlauth values should be ma separated like this
NLAuth nlauth_account: TSTDRV1291212, nlauth_email: $email, nlauth_signature: $password, nlauth_role: administrator
. – Zain Shaikh Commented Jun 8, 2015 at 10:05 -
2
one more thing, trying sending
3
instead ofadministrator
. It's role id actually which is required by NetSuite. – Zain Shaikh Commented Jun 8, 2015 at 10:06 -
1
Thank you @ZainShaikh for pointing me in the right direction. I fixed it using the headers
Authorization: NLAuth nlauth_account=TSTDRV1291212, nlauth_email=$email, nlauth_signature=$password, nlauth_role=3
– Micho Commented Jun 9, 2015 at 1:34 - 1 that's good. let me post it as answer, so you could accept it as answered :) – Zain Shaikh Commented Jun 9, 2015 at 10:49
1 Answer
Reset to default 7nlauth values should be ma separated like this:
NLAuth nlauth_account: TSTDRV1291212, nlauth_email: $email, nlauth_signature: $password, nlauth_role: administrator`
One more thing, trying sending 3
instead of administrator
. It's role id actually which is required by NetSuite.
本文标签: javascriptFailed NetSuite RESTlet authenticationStack Overflow
版权声明:本文标题:javascript - Failed NetSuite RESTlet authentication - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742250058a2440583.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论