vdsdsgzsfh
vdsdsgzsfh

Reputation: 41

Getting 401 from Netsuite REST API

I'm following this tutorial here to attempt to authenticate using Token Based Authentication with Netsuite:

through postman using Netsuite's Postman environment, but I continue to receive "401 Invalid login attempt".

When I check the Login Audit Trail, I see that there is no role being assigned to my authentication attempts -- it's just blank. To me, this indicates that the token is not properly assigned to the User/Role, but I've walked through the directions several times and everything appears to be setup properly.

I've seen other similar posts about this, but those seem to boil down to the Netsuite Account ID formatting. However, my Netsuite Account ID is all numbers, so I don't think this is a factor.

Upvotes: 2

Views: 6185

Answers (6)

Jash
Jash

Reputation: 11

Needed to add REST Web Services permission, Add auth data to request headers. Connection keep-alive did not matter.

Upvotes: 1

Gary Patel
Gary Patel

Reputation: 1

One other setting you need to change in Postman for NetSuite to work is 'Add auth data to' from 'Requests Body / Request URL' to 'Request Headers'

Upvotes: 0

Peter Forsberg
Peter Forsberg

Reputation: 1

i found this article while troubleshooting this error with this exact error message and results in netsuite logs. For me, the role I was assigned to did not have permissions to Rest Web Services in Netsuite.

Upvotes: 0

Michael Batchelder
Michael Batchelder

Reputation: 91

I finally got this to work for me. Postman had a request header of "Connection"="keep-alive". Once I removed that it worked fine! Wow.. I've been trying to get this to work for weeks, looking at it every few days for an hour or two. What a frustrating error message "Invalid Login".

Upvotes: 1

Michael Batchelder
Michael Batchelder

Reputation: 91

I'm having this exact same issue. I have custom code written in Salesforce APEX that is connecting to NetSuite just fine. We also have a Workato integration that is connecting to NetSuite just fine.

No matter what I do in Postman, I get a 401 Invalid Login response. I'm losing my mind...

Upvotes: 1

2ps
2ps

Reputation: 15946

This should work fine assuming you have created an integration and an access token. Configure Oauth 1.0 in postman with the following fields filled out correctly:

  • signature method (should be HMAC-256)
  • consumer key (from the integration you created in netsuite)
  • consumer secret (from the integration you created in netsuite)
  • access token (from the access token created in netsuite)
  • token secret (from the access token created in netsuite)
  • realm (your account id, if using a sandbox, make sure the realm looks like 1234567_SB1, with an _ and not a -)

You won't be able to complete TBA using postman because using netsuite TBA requires a callback URL that netsuite will redirect you to with the necessary credentials (access token and & token secret).

Upvotes: 6

Related Questions