簡體   English   中英

NetSuite RESTlet 身份驗證失敗

[英]Failed NetSuite RESTlet authentication

我試圖在 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');
}

當我點擊提交時,我可以在 Chrome 的開發者控制台中看到狀態為206 Partial Content ,但我提交的記錄沒有存儲在數據庫中,並且在控制台中沒有對此請求的響應。

因此,我決定調查與 RESTlet 的連接。 我的問題是我無法通過 RESTlet 身份驗證。 這是我的 NLAuth 標頭:

用戶代理:SuiteScript-Call
授權:NLAuth
nlauth_account:TSTDRV1291212
nlauth_email: $email
nlauth_signature: $password
nlauth_role: 管理員
內容類型:應用程序/json

顯然,將 '$email' 和 '$password' 替換為相應的值。

“nlauth_role”值是 Netsuite 中的角色 ID。

我正在使用 Postman 來測試這個,我總是得到“ 401 Authorization Required ”狀態和以下錯誤。

{
“錯誤”:
{
"code": "USER_ERROR",
"message": "header 不是 NLAuth 方案 [NLAuth]"
}
}

關於我做錯了什么的任何想法?

nlauth 值應以逗號分隔,如下所示:

NLAuth nlauth_account: TSTDRV1291212, nlauth_email: $email, nlauth_signature: $password, nlauth_role: administrator`

還有一件事,嘗試發送3而不是administrator 它實際上是 NetSuite 所需的角色 ID。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM