Token Based Authentication (TBA) - OAuth - Netsuite - rest web services - Invalid Login Attempt

Viewed 1082

I have been trying to perform a token based authentication (TBA) with netsuite, but keep getting "Invalid Login Attempt"

I tried to refer to this also: How to request Netsuite RESTlet with TBA authentification

And I tried it both on

python:

https://gist.github.com/axilaris/6ecc58e43895dba17ce0ca1b8ce25d9a (please check the code and response error) it was mainly based on https://www.techfino.com/hubfs/Techfino_March2018/Images/Token-Based-Authentication-Guide-for-NetSuite.pdf

and

postman:

enter image description here

enter image description here

Here are my netsuite configuration for the permissions:

enter image description here

enter image description here

2 Answers

"Invalid login attempt" is a generic error thrown by NetSuite when there's something misconfigured in the authentication headers. The best way to troubleshoot this is to use the "Login Audit Trail" search. From there, you should be able to troubleshoot what went wrong with your parameters. It could be that you entered an extra character or blank space into one of your tokens or you’re not generating a new timestamp or nonce.

Follow these steps:

  • Go to Setup > Users/Roles > User Management > View Login Audit Trail.
  • Check the Use Advanced Search box.
  • Click the Results subtab.
  • Add the following fields: Detail, Token-based Access Token Name, and Token-based Application Name.
  • Application Name.
  • Click Submit.
  • The Detail column displays error messages for any token-based authentication logins with a status of Failure.

After carefully debugging I found out that timestamps for generating request token are taking more time. I changed the time offset with my standard time zone. After syncing time, it worked for me. So even token definitions in NetSuite don't expire, timestamps for generating request tokens must be in time-window with time in the NetSuite environment.

Also Check these points:

  • Doesn't have the Web Services Only Role checked.
  • Check that your related integration has the TOKEN-BASED AUTHENTICATION checked.

Try switching from HMAC-SHA1 to HMAC-SHA256 for your signature method. NetSuite is ending support for SHA1 and I already had an issue with it once.

Related